parsing gettext .po files with python?

Radovan Garabik garabik at kassiopeia.juls.savba.sk
Wed Feb 5 17:36:53 CET 2003


Tyler Eaves <tyler at cg1.org> wrote:
> Radovan Garabik unleashed the following on comp.lang.python:
>> 
>> 
>> Is there a module (or something) to parse gettext .po files?
>> I need to extract translated messages from a bunch of .po files,
>> and while I could write my own script to do that, I'd rather
>> not invest the time into reinventing the wheel, if something 
>> similar already exists
>> thanks
>> 
> Like the gettext module, perhaps?
> 

I looked at the documentation (and searched the google), 
but gettext seems to work only with compiled .mo files (and 
in a rigid directory structure at that), and does not seem 
to be able to return the list of translatable strings 
(in other words, you have to know the msgid to be able
to get the translation - I need to get something like
list of tuples (original, translation) for a lot of .po
files acquired from different sources)

-- 
 -----------------------------------------------------------
| Radovan Garabík http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!




More information about the Python-list mailing list