forked from d1zzy/pvpgn
-
Notifications
You must be signed in to change notification settings - Fork 156
Localization Tutorial
HarpyWar edited this page Jun 28, 2014
·
13 revisions
Files for localization are in https://github.com/HarpyWar/pvpgn/tree/master/conf/i18n
Supported languages are: English
, Russian
, German
, Czech
, Spanish
, French
, Italian
, Japanese
, Korean
, Polish
, Chinese
All files are plain text, except common-*.xml
— it contains hardcoded strings. Next tips related to this file.
- You can save original sequence of arguments:
<original>hello {} world {}/{}/{}</original> <!-- hello my world one/two/three -->
<translate>привет {} мир{}/{}/{}</translate> <!-- привет my мир one/two/three -->
- Or swap argument positions:
<original>hello {} world {}/{}/{}</original> <!-- hello my world one/two/three -->
<translate>привет {1} мир{3}/{2}/{0}</translate> <!-- привет one мир three/two/my -->
- When you edit strings, you have to replace next symbols if they were added (update utility replaces it automatically for new strings):
<
→<
,>
→>
,\"
→"
- If you need to display braces then use double braces (
{{}}
will output{}
) - If you are changed > 5% of the text in
common-*.xml
then you can add your author name in<authors>
section. This is not used anywhere, just a hall of fame. - If you edit any localized hardcoded string in
*.cpp
,*.h
,*.lua
, you have to edit that string in section of allcommon-*.xml
files. - If you add a new localized hardcoded string in
*.cpp
,*.h
,*.lua
, you have to run utility fromscripts\localize\update.bat
— it will correctly update allcommon-*.xml
files, and new string will be added. Then find not-translated string in text-editor by<translate> </translate>
- You have to use double quotes in Lua scripts (not single quotes) in localize function:
a = localize(username, "hello \"{}\"", "world") -- correct
b = localize(username, 'hello "{}"', "world") -- incorrect