portable string localization and resource bundles...

Steve Purcell stephen_purcell at yahoo.com
Mon Mar 26 14:40:03 CEST 2001

Clark C. Evans wrote:
> I was wondering if there is a solution to the 
> common problem of string localization 
> (menu and message box titles, for instance).

How about putting your strings in modules 'strings_en.py', 'strings_de.py'
then doing something simple like the following:

>> mylocale = 'de'
>> strings = __import__('strings_%s' % mylocale)
>> f = Frame(title=strings.main_frame_title)

With newer Pythons you can probably use the 'locale' module to handle the
locale strings nicely.


Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo

More information about the Python-list mailing list