Day 27

by fortnight on Fri 05 July 2013 // Posted in legacy // under

Breakthroughs and Revelations

Day two of El Puesto de Limonada(pic related).

Previously on Fortnight's FOSS...

-> The internet gave me this
-> Qalthos explained the part about genpot and that I had to translate this file, Lemonade.pot.
-> FMD showed me the python side of things and I messed around with the gettext.py commands.
-> Fedora linux has a series of "*.mo" files in the "/usr/share/locale/es/LC_MESSAGES/" directory
-> Brian's gone to Los Angeles to find himself?

Just before Lunch, it all clicked together. One had to use msgfmt.py create a .mo file from the .pot file acquired from genpot, with it as a parameter($ msgfmt.py Lemonade.mo). After scanning through the gettext.py source code I saw the correct parameters for the "translations" function; until then I thought I had to give it the path to the Lemonade.mo file that I had placed in my locale directory, but gettext needed to run its "find" function, which is embedded in its translation function. The working lines of code go as follows:

`import gettext

lang = gettext.translation('Lemonade', '/usr/share/locale/', languages = ['es'])

_ = lang.ugettext`

This should get things done, so long as one places a copy of their ".mo" in their LC_MESSAGES directory.

Now I just have to solve the problem that arise from all the accent marks.

My feelings for the day