[spambayes-dev] State of I18N
Hernan Martínez Foffani
hernan at orgmf.com.ar
Thu Oct 21 08:19:09 CEST 2004
>> Some things may require some rework though:
>> - Multiline messages that use one print sentence per line.
>> (Replace those by "xxx\r\n" "yyy\r\n" "zzz\r\n"?)
>
> Is this to make the translating easier so you have more context, or
> for some other reason?
I would adjetive "posible" instead of "easier". While editing the
messages file the translator can't figure out without any doubt that
a collection of subsecuent portions of strings have a meaning.
>> - Those that mix literal strings with parameters concatenating
>> them instead of using placeholders.
>
> You mean "string" + var + "string" instead of "string %s string" %
> (var,)? I'd much rather stick with the latter, if possible.
I meant the latter too. I was enumerating the possible problem only.
>> DIRECTORIES
> ...
> We can setup the binary however we like. At the moment, in the
> application directory there is a "bin" directory and a "lib"
> directory. I suppose "languages" ought to go in the top level or in
> "lib" - the top level would match the source, so it might as well be
> that, I guess.
Fine. I stick with "language" at top level.
>> To imitate the fallback behaviour for dialogs I had to play
>> a bit with sys.path. Setting a language, besides
>> initializing gettext, appends
>> __file__/../Languages/langcode/DIALOGS and
>> __file__/../Languages/langcode[0:2]/DIALOGS to sys.path.
>> (Actually it's not __file__ but this_filename and it's not
>> [0:2] but the first "_" split.)
>>
>> Say the locale "es_ES", then SB will try to import
>> "i18n_dialog.py" from "Languages/es_ES/DIALOGS" then from
>> "Languages/es/DIALOGS". If it fails it fallbacks to the current code.
>
> Rather than using __file__ (which is what is in this_filename?), use
> manager.application_directory (or self.application_directory if this
> is in the Manager class). (But I can make this change to any patch,
> anyway).
this_filename has either __file__ if it is from source or the path
to binary dll on a frozen distribution.
Didn't see manager.application_directory, I'll check it. But take in
account that I need to register the translation very early to catch
(and translate) as many messages as possible.
>> GETTEXTED DIALOGS
> [...]
>
> This sounds workable to me, but I'd have to see it in action to
> really get an idea of what is happening (I'm only vaguely familiar
> with rcparse anyway).
I'll upload the patches later so you can see that better.
Thanks,
-H.
More information about the spambayes-dev
mailing list