tech-install archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: reworking sysinst: A Lua based msg system
On Sun, Mar 04, 2012 at 12:45:18PM +0100, Marc Balmer wrote:
> >> 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.
>
> Message _are_ data. They are organized in Lua tables, the msg()
> function takes such a table and adds it to the respective language
> message catalog (stuff in {} is a Lua table). Keep in mind that Lua was
> designed as a data description language and has a powerful syntax for that.
I guess what martin means here is that the message catalogs should not be
inside LUA scripts, but in separate files (just as they are now). Then
a module can add a new file to the already existing message table
(like msg('/path/to/module/messages.catalog')). Maybe msg() should then
try to load the message.catalog for the current language, as well as
the english one for fallback.
>
> >
> > How do you identify messages in your code? By index?
>
> By index:
>
> msg('english', { monday = 'Monday'})
>
> msg_display(_M.monday)
BTW, should a module be allowed to overwrite an existing index ?
or maybe each module should have its own namespace ?
> [...]
> >
> > - 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
>
> That could probably be done in sysinst itself.
I don't think a translator should have to build a run sysinst to find this.
This should be available as a host tool.
--
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
NetBSD: 26 ans d'experience feront toujours la difference
--
Home |
Main Index |
Thread Index |
Old Index