[spambayes-dev] State of I18N

Kenny Pitt kennypitt at hotmail.com
Wed Oct 20 20:51:19 CEST 2004

Hernán Martínez Foffani wrote:
> I mentioned before that I would like to make rcparser.py gettext
> aware so a translator could work out a solution without having to
> edit the resource dialogs.  
> The problem I found is that the output of the parser is a dict that
> includes string literals subject to be translated (like caption or
> labels) and literals that do not (like font names.) Once in the dict
> there's no way to differentiate between them.   
> As I expect that changes in the dict would imply changes all over SB,
> I thought of a partial solution (call it a hack) that may work. 
> AFAICT, SB does not use the output of rcparse directly but through a
> rc2py previous process.  So how about a subclass of str that override
> __repr__ ?  Then, rcparse only needs to create instances of this
> class for labels, captions, etc., not for font names (or every
> literal can be of this new type and an attribute flag can drive
> __repr__ accordingly.)     

I'm not that familiar with gettext, so I may be way off base here.  However,
if you can make the parser smart enough to use different classes for
translatable vs. non-translatable strings, wouldn't it be possible to just
put the _() around the translatable strings and leave it off for
non-translatable ones?  Once the strings are written out to dialogs.py with
the correct markers, you could run the pygettext utility against it to
extract the appropriate strings for translation.

Kenny Pitt

More information about the spambayes-dev mailing list