Re: reworking sysinst: A Lua based msg system

Martin Husemann <[email protected]>
Newsgroups gmane.os.netbsd.devel.installation
Message-ID <[email protected]>
On Sun, Mar 04, 2012 at 12:24:59PM +0100, Marc Balmer wrote:
> - support for easy translation into foreign languages
> - support dynamically created message that contain variables
> - be modular insfar as sysinst extension modules can come with their own
> set of (translated) messages

Why are you not using existing functionality for this (like catopen(3))?
I don't mean to imply that this would be a better solution, but the
reasoning should be made explicit and clear.

> Message catalogs
> 
> 	Messages are organized in message catalogs, one catalog per language.
> Once a language has been selected by the users, only that message
> catalog is used.  Message catalogs are Lua tables and a Lua script can
> add its messages by calling the msg() function:
> 
> msg('english', {greeting = 'Hello', monday = 'Monday'})
> msg('german', {greeting = 'Guten Tag', monday = 'Montag'})

Messages are data, not program code - keep them separate.

How do you identify messages in your code? By index?

Besides the "modules need to be able to add messages (including translations)"
property you cited above, there are two tremendously important properties
a new scheme should provide:

 - if a translation is missing, automatically fall back to english
   (so a new message can be added as english only and native translators
    can pick it up later)

 - there needs to be an easy method to query all the tables for missing
   translations for a give language, i.e. something like 

	make list-missing-translations LANG=de

   and it would print the identification and english text of all messages
   that have no german translation yet


Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.