[i18n] Multilang. app in Python (English, French, German)?

F

F. GEIGER

Is there a way to do this in a professional manner?

For now I only can think of having all strings in a file, read them into
a dict at startup and then access them like so:

print str(MyTextDict('e', "errorOnDbStore"))

or

print str(MyTextDict('f', MyTextDict._ErrorKey_ErrorOnDbStore))

Is it this or is there a "more Pythonic" way?

Kind regards
Franz GEIGER

P.S.: I'm on Windows and use wxPython for the GUI part. I intend to be
able to select the language in an INI file before starting the app.
 
V

vincent wehren

F. GEIGER said:
Is there a way to do this in a professional manner?

For now I only can think of having all strings in a file, read them into
a dict at startup and then access them like so:

print str(MyTextDict('e', "errorOnDbStore"))

or

print str(MyTextDict('f', MyTextDict._ErrorKey_ErrorOnDbStore))

Is it this or is there a "more Pythonic" way?

Kind regards
Franz GEIGER

P.S.: I'm on Windows and use wxPython for the GUI part. I intend to be
able to select the language in an INI file before starting the app.

wxPython has functionality in place for i18n (propably similar to what
gettext does, which means it involves .po files - which are message
catalogs). Look at the chapter "internationalization" in the wxWidgets
documentation, its under "Topics Overview".
 
F

F. GEIGER

Thank you, Michel and Vincent,

I went for the gettext module - a very comfortable way to manage multilang
strings, indeed.

Kind regards
Franz GEIGER
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top