A blog for archiving the pycs-devel mailing list
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:
pycs_setting.py 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
pycs_translation.py (new module) has support for the message files. Those
are named pycs-XX.msgs with XX currently only being "de" (as that's my
pycs.py 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/rankings.py, weblogUpdates.py, searches.py, referers.py 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.