How do I translate a quickly project?
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
Solution 1:
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.
Solution 2:
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.