I used gettext in xmm2tray. You can have a look at the code as an example:
http://code.jollybox.de/hg/xmms2tray/file/04443c59a7a1/src/xmms2tray/__init__.py
I tried this:
# -*- coding: utf-8 -*-
import gettext
gettext.bindtextdomain('multilanguage', 'E:\folder')
'\f' is, IIRC, the form feed character. Use forward slashes or escape
your backslashes properly.
gettext.textdomain('multilanguage')
_ = gettext.gettext
I specified the translation file location in the gettext.translation
call, but I'm no expert; I assume this'll work too.
# ...
lang1 = gettext.translation('multilanguage', languages=['sk'])
use fallback=True here if you want it to work without translation files
(simply using the string passed to _())
lang1.install()
print _('This is a translatable string.')
but ErrNo 2 no translation file found for domain: 'multilanguage'
I am doing something wrong way. I would like to switch languages in my
program 'on the fly' without affecting windows.
The usual way of using gettext is to use the system locale to determine
the right language. Of course, you can have different translations and
install() them (I expect), but you'll have to re-load all the strings
displayed in your application when you switch language, which might be
tricky.