[Sugar-devel] Help required in localization of FoodForce2

vijit singh vijitthetopcoder at gmail.com
Sat Jun 20 14:58:09 EDT 2009


Hi Tomeu,

Thank You for your kind and quick reply. I am thinking of a small activity
which can be easily localized and whose code can be easily understood. I
will be writing a very small pyGTK activity from scratch or otherwise I will
be localizing a simple activity like 'HelloWorld' which is a simple tutorial
activity made by sugarlabs. I will soon mail the details about the same.

Regards,
VIJIT

On Sat, Jun 20, 2009 at 11:11 PM, Tomeu Vizoso <tomeu at sugarlabs.org> wrote:

> 2009/6/19 vijit singh <vijitthetopcoder at gmail.com>:
> > Hi everyone,
> >
> > I am a software engineer at SEETA (http://seeta.in) working in the Food
> Force II project. I have been recently trying to localize this project to
> Hindi, and have run into issues towards doing the same. I have followed the
> steps mentioned at the wiki pages, and I am not sure, where I could have
> gone wrong. Please find the details of the steps followed by me below-
> >
> >
> > 1. Selected the strings from the project files, which I wanted to
> translate. Selected 5 of them. These were contained in 2 python modules. So,
> I included gettext in these 2 modules, and then wrapped the 5 strings in
> gettext. Please find the details as follows-
> > from gettext import gettext as _      # at the top of both the modules
> >
> > _(‘string to be translated’)        # with the 5 strings
> >
> > 2. Created a sub-directory namely "po" in the main FoodForceII directory.
> Then, I created POTFILES.in file in the po directory, and added-
> >
> >    encoding: UTF-8
> >
> >   Foodforce2.py
> >
> >   gui_buttons.py
> >
> > FoodForce2.py and gui_buttons.py are the modules, which contain the
> strings to be translated.
> >
> > 3. Tried creating the .POT file for FoodForceII. Ran the olpc-setup.py
> file (the setup file for FoodForce2) with genpot command. Received the
> following error message-
> >
> > Xgettext error: Can’t include the svgsprite.py file: no such file exist
> >
> > svgsprite.py is a module required for running pygames in the sugar
> environment. Encountered similar error with every file in the olpcgames
> folder placed in the activity bundle.
> >
> > I experimented with moving the olpcgames folder outside the FoodForceII
> bundle, and then ran olpc-setup.py file with genpot. The FoodForce2.pot file
> was created in the po folder.
> >
> > 4.   Now, I copied back the olpcgames folder into the FoodForce2 main
> directory .Now, we were supposed to generate a .po file. As, I was firstly
> translating the game into hindi language ( a regional language of INDIA); I
> gave the following command from inside the po folder in terminal-
> >
> > msginit -l hi
> >
> > hi becoz we were generating po file for the hindi language. It was
> successfully done and the hi.po file was created. So, now our po folder
> contains the following three files-
> >
> > FoodForce2.pot     hi.po     POTFILES.in
> >
> > 5.   Now, the next step was to add the hindi text in the msgstr part in
> the hi.po file . As I am proficient in the hindi language I did the
> translation on my own using a hindi editor. The translated strings were
> placed between the quotes in the hi.po file for the 5 strings-
> >
> > msgstr “  “
> >
> > 6.   So, the next and final step was to make the .mo file. Firstly I
> created the following directories-
> >
> > locale/hi/LC_MESSAGES
> >
> > where the locale sub-directory was located directly in the FoodForce2
> directory and hi was contained in locale sub-directory and LC_MESSAGES in hi
> sub-directory.
> >
> > Now, I ran the following command from inside the po folder in the
> terminal-
> >
> > msgfmt hi.po  --output='../locale/hi/LC_MESSAGES/
> org.laptop.FoodForce2.mo'
> >
> > And so the org.laptop.FoodForce2.mo file was generated in
> locale/hi/LC_MESSAGES
> >
> > 7. As all the necessary steps were done, I made a new xo bundle for
> FoodForce2 and then changed the language of my sugar environment to Hindi
> and then installed the bundle on it and ran the game. But, instead of the
> strings which I tried to translate appearing in HIndi, they appeared in
> english only.
> >
> > As these steps didn't result into a successful localization, I tried some
> other ways also but none gave the right result. The other changes which I
> made were-
> >
> > 1. As the i18n page I mentioned earlier in the mail was not very clear
> about this , so I included all the python modules present in FoodForce2
> directory in the POTFILES.in and then generated the .pot file as done in
> step 2.
> >
> > I am still trying to work out why the translation is not taking place
> successfully. I would highly appreciate if anyone can send me some ideas
> about why it didn't it worked properly.
>
> I'm sorry but I don't have any concrete recommendations. What I would
> do in your place is to get a very simple activity written from scratch
> and make localization work there. After you got that, you could move
> to add localization to FoodForce with a more knowledge of what is
> required.
>
> It will be also easier to answer your questions about such a simple
> activity than about a big one like FoodForce.
>
> Hope it helps,
>
> Tomeu
>
> > Regards,
> >
> > VIJIT SINGH
> > _______________________________________________
> > Sugar-devel mailing list
> > Sugar-devel at lists.sugarlabs.org
> > http://lists.sugarlabs.org/listinfo/sugar-devel
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20090621/bb17b573/attachment.html>


More information about the Devel mailing list