From this page
     http://dabodev.com/wiki/Internationalization
it sounds like Internationalization is not yet working.  Does anyone 
know for sure?

The methodology seems kind of combersome.  Another approach is to have 
Python phrase file for each language.  A phrase file contains a Python 
dictionary of translations.  (I put all phrase files in a subdirectory 
called languages.)  For instance, a French phrase file might look like this:

# -*- coding: iso-8859-1 -*-
phrases={
"File" : "Dossier",
"Edit" : "Éditez",
"Tools" : "Outils",
"Navigation" : "Dossier",
"Help" : "Aide",
"About" : u"Au sujet de"
}

To make the phrases accessible, start with a Python class which defines 
preferences.  Each field on the class is a preference, such as language.

A small function to activate translation:
def translate(phrase):
        lang = prefs.locale
        if lang == 'us_en':
                return phrase
        try:
                exec 'from languages.' + lang + ' import phrases'
                xln = phrases.get(phrase,phrase)
                return xln
        except:
                return phrase

Preferences and the translation function can be made readily accessible 
by including at the top of the application:
   setattr(__builtins__, 'prefs', Preferences())
   setattr(__builtins__, '_', translate)
For instance, prefs.lang could be 'us_en' or 'fr' or 'sp' or whatever. 
By changing prefs.lang, all phrases in the application which are 
encapsulated  _("some phrase or another")  are automatically translated. 
  And, if the exact phrase doesn't exist in the phrase file, the 
original phrase is used.

Brian



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to