Translating
Translating the game is done using VGui Localization (https://developer.valvesoftware.com/wiki/VGUI_Documentation#Localization). The individual language files are generated by: http://translate.empiresmod.com/
Translation Workflow (Developers)
- Create a feature that requires text messages to be sent to the user.
- Add a new section to mp/game/empires/resource/empires_template.txt:
- // Great new feature
- Create identifiers with their english version for the strings you use:
- "emp_great_hello" "Hello World"
- "emp_great_tip" "Tip: %s1"
- "emp_great_press" "Now press %k{+use} to build this building"
- Lookup the localized strings in code:
- By using the ClientMessage system:
- ClientPrint(player, HUD_PRINTCENTER, "#emp_great_tip", "#emp_great_press");
- // Prints: "Tip: Now press E to build this building"
- By using a manual lookup:
- const char *message = g_pVGuiLocalize->FindAsUTF8("#emp_great_press");
- char expanded[2048];
- ExpandPrintFKeyNames(expanded, sizeof(expanded), message);
- // expanded now contains: "Now press E to build this building"
- By using the ClientMessage system:
- You can temporarily copy the empires_template.txt over the empires_english.txt file to test your changes. Make sure not to commit it though. (The encoding is weird and won't be merged correctly)
- Create a pull request.
- Get your pull request accepted into develop.
- The translation system now automatically adds the new strings to the translation system.
- Translators will see new strings they can translate.
- Once strings are translated new compiled versions will appear once an hour at http://translate.empiresmod.com/compiled/ and will appear in the repo in the empires_assets:translations branch.
- You can place these in mp/game/empires/resources/ to test our your feature in other languages.
- Before a release the translations branch will be merged into develop.
Translation Workflow (translators)
- Contact one of the developers to get translation access.
- Sign the Contributors Agreement.
- Log in to http://translate.empiresmod.com with the credentials you received.
- Start translating strings for the languages you're proficient with.
- The strings you translate can be placed in game by using the files at http://translate.empiresmod.com/compiled/ These files are updated once an hour if someone updates a translation. You can place these files in the empires/resource/ folder in your empires install.
- The updated strings will be merged before a release so make sure you check the website regularly to see if there are more strings to translate. (If certain strings aren't translated before a release those messages will appear in English.
Changing a description in game
- Download the template file from http://translate.empiresmod.com/compiled/empires_template.txt
- Make the changes to the descriptions. Be sure to keep the keys the same.
- Send the changed file to one of the developers, preferably by uploading the file to the Translations channel in hipchat.
- If the developers decide to merge your changes the strings will update automatically for all languages.
- Add translations for all languages
- Go play the game after release :)