How translations and strings files work

Follow this forum if u are a modder (having the modded version)
Contains announcements and how-to guides
Useful for forumers who want to learn how to help out in the game
Post Reply
Stratego (dev)
Site Admin
Posts: 14553
Joined: Fri Apr 25, 2014 9:28 pm

How translations and strings files work

Post by Stratego (dev) » Mon Nov 29, 2021 7:05 am

In the game we have a core strings.xml file and a theme strings.xml one for ALL languages.
- core means the common texts among all alternatives (AOs, AOF, AOG and so on, like: main menu button texts, message dialog texts and so on)
- theme means the custom strings for that alternative only (eg. AOS, like: unit names, unit descritions and so on)

If consider translations of an alternative to a language it will have core files (english + target language) + theme files (english + target language) to a sum of 4 files.

how to translate:

rules
1. Editor: use only simple text editors, so Microsoft Word is not good. I use TextPad it is free and will not ruin any formating in xml files. On phone i use Total commender text editor.
2. Keep line order: you must not delete any lines from any file or insert new line into the middle of any file, so line order should be kept. So only APPENDing to the end of files is possible (i mean the target language files)
3. Keep xml format: only translate the blue part from a line, touching any other part will ruin the xml format or will ruin the "key" of the string line
<string name="network_list_emptytext_server_down">Server cannot be reached.</string>
4. Escaping ' character: in strings file all ' characters should be preceded by \ so write like \'
wrong example:
<string name="account_fail_reenter">The two passwords don't match.</string>
good example:
<string name="account_fail_reenter">The two passwords don\'t match.</string>
5. Special signatures in text: There are replacement strings, that are replaced in code, you should keep those untouched, so RED part must not be modified, only blue parts are to be translated:
<string name="dialog_ask_next_turn_skip_player">Skip %1$s\'s turn?</string>
<string name="game_menu_t_score_end_game">If you win now:\nXXX1 (XXX2/XXX3 turns)</string>

So specials can be:
newline character:
\n
replacement strings from code:
%1$s
%2$s
%3$s
%1$d
%2$d
XXX1
XXX2
XXX3


How to work on translations:
IF you work on the Core file, you work on both files at the same time the English and the Target language file, do this:
1. Find the last line in the translation file (that is probably shorter than the english one, as english probably has new lines since last translation)
2. Find the same line in the english file
3. Copy all english lines AFTER the last line and and Paste to the END of translation file
4. you can close the english file and from now working only on translation file.
5. go tru the first 3-4 lines to be translated translated, translate and and send the translation file to DEV to check - so He can confirm you are doing it in good format.
6. if DEV confirmed than go tru all new english lines in translation file and translate to the translation language.
7. at the end you will have 2 files with same amount of line in same order, one is in english other is in the translation laguage.

The above sequence is the same for the "theme" file pair too.

Post Reply

Return to “Modders lounge”