Updating Translations with lupdate

From PsiWiki

(This page is based on a mail from Novica Nakov on the Psi-Lang mailing list)


To update a translation to include new strings from a newer release:

you need a recent Qt (e.g. 4.3.2), Subversion (svn) and Python.

Get the source using a release archive or from svn

1. make sure the language you are going to translate is listed in src/src.pro, if not add a line for your language and report that your language is missing to the Psi developers.

2. configure the source:

./configure

3. create files needed to translate Shortcuts: when using a release archive get the admin directory from svn:

svn export http://svn.psi-im.org/psi/trunk/admin/ admin

4a. with the admin directory in place proceed as follows:

make src/Makefile
cd src
make translate_options
cd ..

4b. or make that instead of 4a (works better for me on GNU/Linux):

cd src
python ../admin/update_options_ts.py ../options/default.xml > option_translations.cpp
cd ..

5. Create a lang dir in the root of the source tree:

mkdir lang

6. Place a copy of the old ts file in the lang dir Run:

lupdate psi.pro -ts

7. This will create a lot of empty .ts files for other languages and update one .ts file - your old one.

Explanation to step 4b: The shortcut strings are saved in an XML file called default.xml, but lupdate only reads the strings from .cpp files. So the python script /admin/update_options_ts.py creates a dummy file called option_translations.cpp from the src/options/default.xml file and saves this into the folder where the script is started. This file has to be in the src/ folder, so you start the script from that place. The python command is used to run the python script.