How to translate game/editor to a language.
Stunt Rally supports translating (nearly all) visible strings in Game and Editor.
Supplying translations, even small typo fixes, is a great way to contribute.
You can easily and conveniently translate on the webpage:
https://www.transifex.com/projects/p/stuntrally/
You can also download the translation from there and translate it locally using a tool like eg. PoEdit.
There are lots of strings to translate, above 1100.
This is the recommended order in which to translate.
Example for Boost string:
Game.layout :1076..SingleRace.Game.Main.Text :1133..SingleRace.Game.Tab :2842..Options.View.Camera.Check ogre/Challenges.cpp:596 ogre/Gui_Init.cpp:521 ogre/Gui_Network.cpp:132
So, this string Boost, can be found in Gui:
And in above mentioned source files with line numbers.
Line numbers are combined if in same file e.g.
ogre/Gui_Network.cpp:29:345:567
To do this you need to get the .po file back from webpage (download).
Or if you translate with a program locally just save it and get the new .po file.
Run the python script locale/xml_po_parser.py on the .po file to get a *_tag.xml file back.
e.g. inside locale/
xml_po_parser.py de.po core_language_de_tag.xml
Move the xml into data/gui. Start game or editor and test.
If you build from sources, and you translated something recently, then
when you see on master a commit 'Sync translations.' this means that
translations have been updated and you can now check them (after pull).
We use gettext's .po and .pot files for web translations, it is a very popular text format.
All strings in Stunt Rally are in the xml file data/gui/core_language_en_tag.xml.
Used by MyGUI's own translation system.
This file is edited manually, each new string is added there.
It also has xml comments with group names,
which then show up as Develeoper comment on web (as #. in .pot file).
A C++ program (source/transl/main.cpp) generates sr.pot templates file from the xml file.
It also searches for string references in sources and Gui layouts, also getting widgets hierarchy.
Web translation gives translated .po files back, which are then converted to
MyGUI's translations (other languages *_tag.xml)
by the locale/xml_po_parser.py python script.
This is a section for developers, who want to do fast translation updates.
Download the Transifex client (command line tool).
It can both pull new .po translations from website and push new .pot to it.
The commands for that are: 'tx pull -a' and 'tx push -s'.
See Transifex documentation.
To setup, I used (in our locale/ dir):
tx init tx set --auto-remote
and manually edited .tx/config file to put repo url, and source_file with .pot.
This is the final .tx/config file used:
[main] host = https://www.transifex.com [stuntrally.srpot] file_filter = translations/stuntrally.srpot/<lang>.po source_lang = en source_file = sr.pot type = PO
For reference the user config file .transifexrc in your OS user dir:
[https://www.transifex.com] hostname = https://www.transifex.com password = pass token = username = user
Replace user and pass with your login.
Currently to sync translations on Windows you need to have in locale/ dir:
sr_transl.exe - is build from source/transl/main.cpp, open project proj/sr_transl.vcproj
tx.exe - is the downloaded Transifex client.
Having that set up, run in locale/ dir:
tx_1upd-all.bat
(to update .pot, push it, pull .po and convert all to .xml)
and then
tx_2git.bat
(to commit and push).
See example commit adding Czech (cs) language: link
Needs to be added in 4 places:
data/gui/core_language.xml
<Info name="cs"> <Source>core_language_cs_tag.xml</Source> </Info>
data/gui/core_language_en_tag.xml
<Tag name="LANG_CS">Čeština</Tag>
Language name in this language (found on e.g. Wikipedia).
This will be visible in combobox on Gui.
Note that it needs translation update after, to have the new tag in all languages.
source/ogre/Localization.h
else if (!strcmp(buf,"Czech")) loc = "cs";
English name of language from windows GetLocaleInfoA function.
source/ogre/common/GuiCom_Util.cpp
languages["cs"] = TR("#{LANG_CS}");