What you need for translating the GUI¶
First of all it depends on your Operating System.
- A proper git client (with some examples you could use - there are several more clients available)
- git for the command line (aptitude install git)
- Qt-Linguist for doing the translation (actually there are also several more Translation Editors but Linguist is the recommended)
- Linguist for Debian based Linux is actually in the qt4-dev-tools package (aptitude install qt4-dev-tools) executeable called linguist-qt4
- Linguist for Windows can be found [here]
Updating .ts file for existing translations¶
You should regularly regenerate your .ts file to update it with string changes in GIT. From time to time the release manager will do this too and commit them in a batch to GIT.
In order to regenerate the .ts files needed by Linguist, there is a special script available in the source of QGIS called update_ts_files.sh. So first you need to check out the sources from GitHub repository. This is described on the DevelopersManual (Section 2) page in this wiki. Next you need to run the update_ts_files.sh script which should give output like this (script depends on libxml-simple-perl package).
tim-suttons-computer:~/dev/cpp/qgis timsutton$ ./update_ts_files.sh Creating qmake project file Updating translation files src/gui/qgsvectorlayer.cpp:1133: Unbalanced braces in C++ code (or abuse of the C++ preprocessor) src/providers/delimitedtext/qgsdelimitedtextprovider.cpp:760: Class 'QgsDelimitedTextProvider' lacks Q_OBJECT macro src/providers/mysql/qgsmysqlprovider.cpp:171: Class 'QgsMySQLProvider' lacks Q_OBJECT macro Updating 'i18n/qgis_cs_CZ.ts'... Found 2037 source texts (0 new and 2037 already existing) Updating 'i18n/qgis_de.ts'... Found 2037 source texts (0 new and 2037 already existing) ...etc... Removing qmake project file
For 0.9.x version updating translation files is done like this:
Once that is done, open the translation file you will be working on with Linguist e.g. :
or in kbabel
Now proceed with your updates. When the work you were planning is complete, email the file to werner.macho [at] gmail.com (Werner Macho) or otto.dassau [at] gmx.de (Otto Dassau) and we will commit your changes (unless you already have commit access).
Note: It is not neccessary to build all the sources first to generate the ts files.
Creating a .ts file for a new language¶
In order to create the .ts files needed by Linguist, there is a special script available in the source of QGIS called create_new_ts.sh. So first you need to check out the sources from subversion. This is described on the DevelopersManual (Section 2) page in this wiki. Next you need to run the create_new_ts.sh script like this.
cd <top of qgis source tree> chmod +x scripts/*.sh ./scripts/create_new_ts.sh [Your locale abbreviation]
So for example to generate a new .ts file for en_GB do this:
A new .ts file will be created in i18n that you can then proceed to translate using linguist or kbabel.
Note: For some OS you might need to adapt the path to qmake-qt4 and lupdate-qt4 in the script create_new_ts.sh
As the source code is changed, small (or sometimes large) changes may be made to text in the user interface. You should regulary update your git working copy and rerun the ts file updater. You can do this as often as you like - it should not lose existing changes you have made in your ts file (though keeping backups of your work is always a good idea).
Translating help files for e.g. field Calculator¶
Thats currently a bit tricky though you don't have any programs for that.
You can find the files for translation in the source code of a git-cloned Quantum-GIS repository.
It's just a matter of taking a normal editor (vim,emacs,notepad++,gedit or whatsoever) and opening the "original" en_US file ..
Than translate everything from english to your language and save it as the same name with just the en_US at the end changed to the Code of your language ..
for German it looks like .. QgsFieldCalculator-en_US -> QgsFieldCalculator-de_DE
Thats all .. pretty easy uh?