Updating Translations with lupdate
From PsiWiki
This article helps you updating a translation file to include new strings from a newer release:
If you want to update your translations for a newer release, see Translation_Howto for instructions. The way described here is no longer supported and will be removed soon.
Contents |
[edit] Requirements
[edit] Get the Source
[edit] Version 0.12
Get the source using Git and switch to the version you want to update your translation file with:
git clone git://git.psi-im.org/psi.git cd psi git checkout 0.12
To keep your local copy up-to-date, just pull the latest changes:
git pull
[edit] Latest Development Version
Get the sources using Git
git clone git://git.psi-im.org/psi.git cd psi git submodule init git submodule update
To keep your local copy up-to-date, run the following commands in your checkout:
git pull git submodule update
[edit] Modify the Project File
Change the TRANSLATIONS line in src/src.pro so that it contains your language file:
TRANSLATIONS = $$LANG_PATH/psi_xx.ts # switch xx with your language code
[edit] Run Configure
Configure the source:
./configure
[edit] Some Extra Work
4. Create files needed to translate shortcuts (either 4a OR 4b):
4a.
make sub-src-qmake_all # or maybe make src/Makefile depending on your Qt version chmod a+x admin/update_options_ts.py cd src make translate_options cd ..
4b. This works better for me on GNU/Linux:
cd src python ../admin/update_options_ts.py ../options/default.xml > option_translations.cpp cd ..
[edit] Final Preparations
5. Create a lang dir in the root of the source tree and copy your old translation file into it:
mkdir lang cp /path/to/old/translation/file/psi_xx.ts lang/
[edit] Run LUpdate
6. Run lupdate:
lupdate psi.pro
[edit] The Result
This will update the .ts file for your language. You can find it in the lang/ folder.
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.