forked from Freeseer/freeseer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtranslate.txt
executable file
·76 lines (43 loc) · 3.52 KB
/
translate.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Internationalisation of Freeseer
Changing languages
To change the language simply click:
options -> languages and select a new language from the menu
Adding a Language
Creating the translation files
Go to the src folder and open the directory tools. Simply run:
"make"
This will compile the gui. Once this is done you can run:
./create_language
If you need to update the current language files open the update menu and click Update Translation Files.
In order to add a language select the language from the drop down menu. Once a language has been selected the list
of countries for that language will appear in the second drop down menu. If a language is dramatically different
for a specific country then this is important.
An example of where it does not matter would be english. US english is understood by all english speakers. However
for languages such as chinese, this could make a difference.
The appropriate .ts file will be created in /src/freeseer/frontend/default/languages
Translating the Text
Open the language file created with step 1 or a previously existing .ts files
with QT Linguist. You will be prompted to select the target language and the source
language. Select english as the source language.
In the context area (left side bar). Under the context MainApp there is a single word
'language_name'. This is where you put the name of the language that will appear in the language
menu. Note: This must be filled in, in order for the language to appear in the menu
The instructions for using QT Linguist can be found at:
http://doc.qt.nokia.com/4.1/linguist-translators.html
Creating the (.qm) files
Qt uses .qm files to translate the text at runtime. The files can be generated using
Qt Linguist. Once step 2 is complete, the qm file can be generated from the ts file by
going to file -> release. This will create the .qm file with the correct name.
Developers Guide
Adding New UI Designer Files
For each object that can be translated, there is an option , under text in the property browser, that can be set to true if the text is to be translateable. This option is checked by default. When the .py file is generated from the designer file, it will contain all the code necessary for the translation of the object. The language creation tool assumes that the .py file to be generated has the same name as the .ui file. If this is not the case you will have to remove the ui .py files before updating the languages. Secondly, the tool assumes that the UI files are all in the forms directory.
Adding New Words(manually not using QT Designer)
New words can be added for translation in two ways. If the words are in a QObject the words to be translated should be passed to self.tr(). If not the the words should be passed into the translate function of the QTranslator (see QT Documentation for how to use these functions) Once this is done, the language files can be updated.
Updating Languages
The language files can be updated by opening the language creation tool (found in the tools folder in the src) and clicking "Update Translation Files" under the update menu.
Troubleshooting
Recovery From Deleted .ts File
In order to recover the ts file from a deleted .ts one has to open the corresponding qm file with QTlinguist and save it
as a .ts file. After doing this one can update the files and the missing words from the ts file will be added.
Recovery From Deleted .qm file
Re release the corresponding .ts file using QTLinguist.