pycs-devel archive weblog

A blog for archiving the pycs-devel mailing list

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

[ Nov ] [ Jan ]

python community server
pycs developers
also available in XML
Copyright (c) 2002 Phillip Pearson
spread the dot


Georg Bauer: [PyCS-devel] New feature in CVS: translation of strings in the source


I just commited some changes that enable us to use gettext (the python
module, not the GNU library!) to translate strings to different languages.
What I changed: now has a Language method to deliver the configured
language (option language) or 'en' as a default. The language setting is
documented in the pycs.conf.default. If you don't enable language support,
a NullTranslations stub will be used and everything should work as before (new module) has support for the message files. Those
are named pycs-XX.msgs with XX currently only being "de" (as that's my
native language). initializes the translation engine and installs the "_" function
as the translation function for the configured language. This translation
function returns either a translation or the original message if no
translation can be found.

modules/system/,,, are
all changed to now use this new feature. You can see them in action at

To enable us to collect missing translations (or new translations for
stuff that has changed), missing translations are written to a
failedmsg.log file in the log directory. Be sure to rotate that in the
same way as you rotate other logfiles.

I will go through the whole source and use translation on those parts
where it is needed. Mostly this is the modules, but some internals, too.
So there will be a first message catalog for german language. It would be
nice if others would pick up from here and take the pycs-de.msgs as a
starting point to build their own message catalog for other languages.

But please don't start yet, as the first version is very crude and
especially includes very ugly strings, as formatting is still in there. I
will first go through all modules and change their source in a way that
enables me to split between templating code and actual strings, so the
strings in the message catalog will become shorter.


bye, Georg