[I18n-sig] Literal strings

M.-A. Lemburg mal@lemburg.com
Fri, 02 Jun 2000 13:26:07 +0200


Peter Funk wrote:
> 
> Since my native language is German and since my English leaves a lot
> to be desired (take my rants to python-dev as examples), we decided
> long ago to use German as our "master language" in our company for our
> I18N software.  This works pretty well in Python 1.5.2.  Example how
> this looks like:
> 
>         tkMessageBox.askquestion(_("Löschen bestätigen"),
>                                  _("Soll %s gelöscht werden?") % object_name)
> 
> '_()' in this context is an shortcut name pointing to the
> 'fintl.gettext()' function.  This function possibly returns the literal
> translated into English, French or Spanish depending on the language
> environment.  An additional tool (xgettext, now pygettext by Barry W.) is
> used to extract all those literals and to deliver them to professional
> translators which translate these message strings into English, French ...
> 
> Additionally we abopted the style to use single quotes for all literals
> that are normally invisible to a user of the software.  Exmaple:
> 
>         if hasattr(target, 'disable'):
>             target.disable()

Nice idea :-)

I'm currently using my own scheme for solving the NLS problem,
but it currently only work on a per-process basis. What I am
looking for now, is a way to be able to set the language
on a per user (of a single server process) basis.

Is the gettext approach useful for this too, i.e. does it
allow fast switching of the target language ?

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/