I started translating OSQA for French, and experimented my work with
./manage.py compilemessages. I worked fine, but after a hundred lines, I noticed some words and lines, although translated in the po and compiled, were still appearing in English. After some search, I discovered the po files actually in the SVN repository were not generated with the latest source code.
Therefore, I ran
./manage.py makemessages to update the po files that would actually match the source code. I discovered that it created a complete mess in my po file. Some of the translated lines do not correspond anymore to the English line. I am feeling very disappointed, just like I lost a couple of hours for nothing.
Is there any recipe to avoid such annoyance?
I got a version of my po file before regenerating th po. Do you feel like adding it to the repository (only 100 line translated)?
Answer by curiousleo · Jul 31, 2011 at 09:47 AM
I ran into similar problems when I started translating OSQA into German. I think I worked out a translation recipe that Works For Me. If you find out about better ways to do it, please share!
Babel, a Python-centric translation software
BabelDjango, Django plugin for the above
PoEdit, a graphical, multi-platform translation file editor (killer features: automatic translation and update from POT file)
Create a directory (not under the SVN checkout) to put your translation file and Babel settings into (`mylocale`, say).
Copy this into a file called
babel.cfg in your
`[python: .py] [django: /templates/**.*]`
Make sure you are in the
mylocale directory, then create the translation template
django.pot by running
`pybabel extract -F babel.cfg -o django.pot`
Start PoEdit and create a new catalog from the template (`File > New catalog from POT file...`).
Fill in the catalog details under the
Project info tab.
Language is necessary,
Country should probably be left empty. There is no need to fill in anything under
Keywords. Save the file as
Check out the PoEdit Help (`Help > Contents... > Translation Memory`) for instructions to set up the automatic translation.
Your own translation is not in the SVN tree, and will therefore not be overwritten when you
Simply recreate the
django.pot file (Step 3 above), then update your
.po file using PoEdit:
Catalog > Update from POT file...
Use a version control system for your translation files. That way, even if you accidentally overwrite it, you can just revert to your old version and be happy.
Answer by wwwclaes · Apr 10, 2012 at 06:58 AM
Regarding recipes, Google Translator Toolkit just added support for PO files. You upload eg the OSQA English PO file and it can give you a head start on your translation. I just tried it for a Swedish translation and it works quite well.
It didn't translate the fuzzy messages and I wanted those as well so I just removed the fuzzy markers first. There were also some minor issues with the formatting of the new PO file but maybe we can gather workarounds for those in comments to this thread. Most issues were related to Python and HTML formatting and some may also be reported and fixed by Google.