[sugar] Question about internationalization on sugar-jhbuild

Faisal Anwar fanwar at mediamods.com
Wed Jul 2 17:50:12 EDT 2008


Hello All,

I'm trying to set up some simple internationalization on a sugar activity
but am running in to problems. I am specifically using sugar-jhbuild and
launching it with 'LANG=es ./sugar-jhbuild run' command when I want to test
my internationalization out. Here are the steps I have followed (I used
http://wiki.laptop.org/go/Python_i18n and
http://wiki.laptop.org/go/Localization/Testing to guide me):

1. First, I created a directory within my activity (a simple shell fo an
activity which I have called Annotate.activity) called 'po' and I went in to
that directory.
2. In Annotate.activity/po, I created a POTFILES.in file and put the
following text:

encoding: UTF-8
annotateactivity.py

3. I launched sugar-jhbuild and went in to the terminal, where I ran 'python
setup.py genpot' from the Annotate.activity directory. This generated an
'Annotate.pot' file. I went in to Annotate.pot and added some translations
for strings that I knew would need translating in my program (one specific
one was a from a print statement where the string is wrapped in _()).

4. Still in sugar-jhbuild's terminal, I ran 'msginit -l es' which generated
a file called 'es.po'.

5. finally, I did 'msgfmt -o ../locale/es/LC_MESSAGES/
org.laptop.AnnotateActivity.mo es.po' to generate the mo file and place it
within the right directory for spanish (the directory path is similar to the
one I found for Web.activity, whose translations are working fine).

After doing all this, I restarted sugar-jhbuild by using 'LANG=es
./sugar-jhbuild run' . I can see other activities have text translated, but
my activity is not translating the text that I wrapped in _() and was
printing out. I checked the source file and I am using gettext (importing it
as _ and then using the wrapper in the print statement I want translated).

Someone suggested trying to do an strace to see what was happening. I did
this and found the following in the portion of the log where it has any
reference to the string I want translated:


   1.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US.UTF8/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)
   2.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)
   3.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en.UTF8/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)
   4.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)
   5. write(1, "hello world should be translated"..., 33hello world should
   be translated
   6. ) = 33

 1
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
2
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
3
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
4
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
5 write(1, "hello world should be translated"..., 33hello world should be
translated
6 ) = 33
 1
2
3
4
5
6
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
write(1, "hello world should be translated"..., 33hello world should be
translated
) = 33

   1.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US.UTF8/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)

   2.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)

   3.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en.UTF8/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)

   4.
   stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en/LC_MESSAGES/
   org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such
   file or directory)

   5. write(1, "hello world should be translated"..., 33hello world should
   be translated

   6. ) = 33


 1
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
2
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
3
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
4
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
5 write(1, "hello world should be translated"..., 33hello world should be
translated
6 ) = 33
 1
2
3
4
5
6
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en_US/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en.UTF8/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
stat("/home/fanwar/sugar-jhbuild/sugar-jhbuild/install/share/sugar/activities/Annotate.activity/locale/en/LC_MESSAGES/
org.laptop.AnnotateActivity.mo", 0x7fffa41f75d0) = -1 ENOENT (No such file
or directory)
write(1, "hello world should be translated"..., 33hello world should be
translated
) = 33
 I would greatly appreciate any feedback on why translation is not working
here.
Thanks


Faisal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/sugar/attachments/20080702/770d8851/attachment-0001.htm 


More information about the Sugar mailing list