[MPlayer-dev-eng] mplayer and gettext

Nicolás Lichtmaier nick at technisys.com.ar
Wed Nov 20 22:42:38 CET 2002


>
>
>>This is what I have:
>>
>>A script which converts all the help_mp*.h files into .mo files. It
>>includes config.h, so that the .mo files have all the right messages.
>>
>>I've tried an unmodified copy of mplayer against my automatically
>>generated .mo file and now most messages are translated to Spanish! This
>>is so because mp_msg already passes its strings to gettext. (But there
>>are lots of strings which doesn't go through mp_msg (and they probably
>>shouldn't).)
>>
>>This can be included in mplayer's build process *now* to have runtime
>>translations. The translations would be read from the normal .h files as
>>always.
>>    
>>
>
>sounds interesting - anyway i don't know what are the .mo files :)
>(i've heard about .po - but never seen them either)
>

A .mo file is the binary form of the .po file. The compiled version one 
could say.

A .po file looks like this:

-------------------------------------cut--------------------------
#: ../arp.c:208 ../arp.c:222
#, c-format
msgid "No ARP entry for %s\n"
msgstr "No hay entrada ARP para %s\n"

#: ../arp.c:240
#, c-format
msgid "arp: cant get HW-Address for `%s': %s.\n"
msgstr "arp: no se pudo obtener la dirección hardware de `%s': %s.\n"

#: ../arp.c:244
msgid "arp: protocol type mismatch.\n"
msgstr "arp: no coincide el tipo de protocolo.\n"

#: ../arp.c:253
#, c-format
msgid "arp: device `%s' has HW address %s `%s'.\n"
msgstr "arp: el dispositivo `%s' tiene una dirección hardware %s `%s'.\n"
-------------------------------------cut--------------------------

Note that:
* There's no id per message. The id is the English message text.
* printf's format strings are flagged so that the tools can do 
consistency checks.
* The tools tracks where the messages are being used.

>>I have also a script wich replaces all MSGTR_* defines with the English
>>text, marked with _() . The output of this script is stored in a new
>>    
>>
>
>this part refused
>see archives for reasons
>  
>
Ok, no problem... but:

I've checked the archives ( 
http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-July/009379.html ). 
But I don't find the arguments accurate:

* If the .mo file isn't found at runtime, the binary will just use 
English messages.
* Source convertion can be automated (I did it).
* You can switch languages in runtime just by calling setlocale again.
* Config specific messages? You don't need them! The .mo files will just 
have all posible values (little overhead).

And the advantages for translators are HUGE.

Anyway, a mixed solution just using gettext in runtime (extracting .mo's 
from the .h's) can be nice too if you still don't like the full gettext 
approach. I can do whatever you find acceptable.

Thanks!




More information about the MPlayer-dev-eng mailing list