pygettext examples?

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Nov 30 07:48:08 EST 2001


Joseph Santaniello <joseph at arbitrary.org> writes:

> Does anyone have a link or some info on how in practical terms to use the 
> pygettext module? I've looked at the online docs, and they do a good job 
> of explaining in theory how to add multiple languages to an app, but they 
> haven't got me to where I need to be... I need some examples and recipes 
> to be able to figure it out.

I think mailman uses gettext these days.

I'd really recommend that you start using it, and ask any questions
that you have in the process. Here are the rough steps:

1. Import or assign _ in your module, e.g. by doing

   import gettext
   def _(msg):
     return gettext.dgettext("demoapp",msg)

2. Mark-up all messages with _

3. Extract the message catalog

4. Translate it

5. Compile the translations

6. Run the application

If any of these steps, if executed in this order, gives problems,
don't hesitate to ask for further details.

Regards,
Martin




More information about the Python-list mailing list