Translation with quickly

Asked by Steffen Sindzinski

I generated pot, po and mo files mostly following this tutorial: http://faq.pygtk.org/index.py?req=show&file=faq22.002.htp. The mo files I stored in data/locale/en/LC_MESSAGES. Local it works, also with a downloaded source package from Launchpad. But the built package "morewordsplease" from Launchpad doesn't install the subdirectories underneath data/locale there my mo files are.

So I decided to translate in Launchpad and uploaded the pot and po files manually to my trunk branch. I choosed the Launchpad-translation settings that my branch is updated by translation. Now I have successfully translated strings in Launchpad but still not in my build package.

Whats wrong?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Quickly Edit question
Assignee:
No assignee Edit question
Solved by:
Didier Roche-Tolomelli
Solved:
Last query:
Last reply:
Revision history for this message
Didier Roche-Tolomelli (didrocks) said :
#1

Thanks for using Quickly

You don't have to manually generate po and mo file. Quickly do that for you in others directories (the po/ ones).

So, don't generate it manually and each time your run quickly package or quickly share or quickly release, the .po file are processed for you.
If you want people using launchpad translation capabilities, you can read those helps (and you can export and import automatically translation in a branch, like Quickly is using) : https://help.launchpad.net/Translations

About importation and exportation:
- http://blog.launchpad.net/translations/import-translation-templates-from-your-projects-bazaar-branches
- http://blog.launchpad.net/general/exporting-translations-to-a-bazaar-branch

Revision history for this message
Steffen Sindzinski (stesind) said :
#2

Hello Didier,

Thanks for the answer. But I do not understand. Where are po/mo files generated by Quickly located? What is the path? I think if they are generated, I still have to bind them with a command like:

import gettext
from gtk import glade
gettext.install(APP, locale, unicode=True)
for module in (gettext, gtk.glade):
    module.bindtextdomain(APP, locale)
    module.textdomain(APP)

In question: https://answers.edge.launchpad.net/quickly/+question/91879 you mentioned that it is only necessary to add:

import gettext
from gettext import gettext as _

to the code. Don't you have to bind it?

And how can I add a e.g. German translation?

Thanks!

Revision history for this message
Didier Roche-Tolomelli (didrocks) said :
#3

Hey Steffen,

look at the Quickly code: http://bazaar.launchpad.net/~quickly/quickly/trunk/files
You have the po/ directory containing the template and all translations.

.mo files are built when you build the package and doesn't mess up your source code. They will be install in the right place (/usr/share/locale/<lang>/LC_MESSAGES/<app_name>.mo) for you when installing the package.

You can use your gettext domain even if Quickly doesn't do it for you. No need to specifically bind it as importing gettext in python take your application name by default.

To add other translation, the easiest way is to follow my previous links which explains your how to import from a dedicated branch (lp:quickly/0.x for Quickly) and import translations on another branch (again, lp:~quickly/quickly/quickly-po for Quickly itself) that you can merge in your trunk. If someone begin to translate on Launchpad in a new language, the <language_code>.po file is automatically created your export branch (cf previous links).

Is it more clear?

Revision history for this message
Steffen Sindzinski (stesind) said :
#4

Thanks again Didier,

I hope it is OK now. The thing was, that the po/pot file seems only be generated by using <quickly package>. Because of some reasons I did not run this command on this quickly project.

Now:
- I cleaned up my code and folders
- I ran <quickly package>
- I ran <quickly save>
- I ran <quickly share>
- I set the Launchpad translation import settings to automatic import the translation template from my ~stesind/morewordsplease/quickly_trunk
- I created a branch ~stesind/morewordsplease/morewordsplease-po and set it as target branch for exporting the translations
- After my morewordsplease-po branch is updated by launchpad I can merge manually (hopefully)

I have one more question:
If I look at the content of my morewordsplease/quickly_trunk: https://code.edge.launchpad.net/~stesind/morewordsplease/quickly_trunk I see only old revisions/files. Not the latest ones uploaded in the ppa. Does <quickly share> not updated the revisions in my quickly_trunk branch? Or is something else wrong?

Thanks

Revision history for this message
Best Didier Roche-Tolomelli (didrocks) said :
#5

You're welcome :)

(btw, yes, you can merge manually)

About your second question, quickly share is, in our mind, only for sharing a debian package, not pushing the code itself (what quickly release does). I do not have any strong opinion on that and we can change this for 0.4 for instance. I'll see if other people ask for it.
Of course, you can still manually bzr push and bzr pull :)

Revision history for this message
Steffen Sindzinski (stesind) said :
#6

Thanks a lot Didier!

Revision history for this message
Steffen Sindzinski (stesind) said :
#7

Forgot to press "solved".

Revision history for this message
Steffen Sindzinski (stesind) said :
#8

Thanks Didier Roche, that solved my question.