Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am just getting started with using quickly and I have a small project that's starting to take shape.

Right now I would like to add a translation to my project. I already noticed that quickly automatically generates po/.pot but I can't quite figure out how/where to add the language-specific .po files.

I tried creating en.po / de.po / es.po manually inside the po/ sub-directory but - even after I run quickly share - quickly (using quickly run or the installed .deb) doesn't seem to recognize / use the translations.

Am I missing something really obvious/stupid? Any help would be highly appreciated!

Cheers, Marcel

share|improve this question
    
Could you be a bit more specific? Are you sure the .po files you've created have got the right format? What exactly makes you think that the package you create does not recognize the translations? –  David Planella Jun 15 '12 at 14:22
add comment

2 Answers 2

up vote 6 down vote accepted

Translation files (.po files) should live under the same directory as the translation template (.pot file). That's generally the po/ folder:

po/
myapp.pot
de.po
ca.po
..

It's generally the job of the translators to create a .po file for their language out of the template and then send it to the developer, who will commit it to the source tree. Or the cleverer and more modern way: use Launchpad to translate your app and to automatically commit the .po files to your source tree. This way translators will be able to translate online and never have to worry about sending e-mails or knowing about the underlying format.

But anyway, back to the question: if you've got a valid .po file at least, the quickly share or quickly package commands should pick it up and do all the work for you.

That is, they compile the textual .po file into a binary .mo file and put it in the package ready to install.

That should work for your app. However, you can do a test without using the quickly commands. Try running the following command at the top of your source tree, where you usually run the Quickly commands:

python setup.py build_i18n

That should do a local build of the translation files into the build/ directory, where you should find the .mo files.

share|improve this answer
1  
Thank you very much for your extensive answer - It helped a lot :) Short follow-up question: When I install the package and run the installed app, translations work perfectly but if I run it using 'quickly run' it runs completely unlocalized - is this actually desired behaviour, a bug in quickly or somehow my fault? ;) –  lemabu Jun 15 '12 at 20:55
add comment

Also, remember to wrap strings in your app with _() to ensure they are translated. For example.

mywidget.set_text(_("Help"))

When you next run python setup.py build_i18n your POT file will then be generated.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.