Oldest known version of this page was edited on 2010-02-17 02:36:07 by AdminX []
Page view:
How to make translations
Download the template file
pdfedit_xx.ts∞ from attachment
Rename it by replacing xx by desired language code (for example
de for
German translation)
Now you will need to translate the strings in file. It can be done in two ways:
- Either use Qt linguist - application for editing translation files, that comes with Qt. Type linguist to launch it, open the translation file, edit strings, save it.
- Or, edit the file manually.
The file is a XML file, consisting of multiple context blocks, each consisting of one or more messages. In each message block, it is necessary to put the translated message into the
<translation> element and remove the attribute
type="unfinished":
The string can contain numbered parameters, marked
%1,
%2,
%3, and so on, which are replaced in runtime. In the example below,
%1 will be replaced by version of Qt library in runtime.
Example of translating part of file into german:
Chunk with message
<message>
<source>Using Qt %1</source>
<translation type="unfinished"></translation>
</message>
should become
<message>
<source>Using Qt %1</source>
<translation>Mit Qt %1</translation>
</message>
Another example of numbered parameters:
<source>Operator '%1' should have 1 parameter, but has %2 !</source>
%1 will be replaced by operator name
%2 will be replaced by number of parameters
Testing translation files
If you want to test the translation in pdfedit, you have to do the following:
- Type lrelease pdfedit_xx.ts to compile the pdfedit_xx.ts file to a binary file pdfedit_xx.qm
- Copy that file to the directory with other .qm files. It will probably be /usr/local/share/pdfedit/lang, but this may vary depending on configuration. (Also, as pdfedit can work even without installation, you can put the .qm file in src/gui/lang directory and run pdfedit directly from src/gui directory, right where it was left after compilation.)
- Set the correct locale (export LANG=xx) and launch pdfedit
Categories
Development