HRCodWar - Translations

Traducir Translating the campaign into another language is not complicated but requires some effort that surely will be wellcomed by the other language users. ¿How can you do it and this way collaborate to make HRCODWAR better known and easier to fly?, As follows:
Different languages in both the game and the web page

Both the campaign and the web can work in differents languages, You can, for instance, run the campaign in english and use the web in russian. The only problem is that, if you are a commander and program your orders in russian, the game server will not understand them as it would be running in english language. Thus, no matter in wich language the web is displayed, The orders need to be introduced in the language used by the campaign because the chat commands share the same language.

Translation directories

Both the campaign and the web are already translated to spanish and english. If you don´t speak spanish, the easiest way would be start from the english language. Language translation files are stored in:

  • Game server In the directory of missions/hrcodwar you´ll see a subdirectory called /lang, within this directory you´ll find the language tranlation files, each one indentified by its language code.
  • web server: In the project root directory there are two subdirectories.
    • /lang_mis: Here, the same files found in the game server must be stored in missions/hrcodwar/lang, as they are used in those translations to layout the reference documentation about how to use the chat here.
    • /lang_web: Thoses language translation files are specifically used by the web.
Language translation files format

As you could see, All of them share the same extension .json. True, They are files in notation json where the key is the reference used by the program and the value is the translation itsef. You mus not change the key, only translate the value. As everything in this project, Both the campaign and the web are writen in UTF-8 format, there shouldn´t be problems by using non latin characteres.

To add a new language in the campaign

Is quite simple, Choose the language you feel comfortable translating from and duplicate the file, ej. Let say we want to translate from english to russian. We will copy missions/hrcodwar/lang/en.json to missions/hrcodwar/lang/ru.json, and then translate ru.json.
Once we finish, we will edit missions/hrcodwar/conf.ini and moddifiy the variable lang in [GENERAL] from "en" to "ru", showing now lang=ru, having now the campaign in the language used by the saga makers :)
As we have already explained, if you want the chat commands reference to be translated into the real language used by the campaign then you should upload the new language to /lang_mis and translate the web as well :)

To add a new language in the web

Is similar to how we have done in the campaign, Using the same english to russian example. Copy /lang_web/en.inc.php to /lang_web/ru.inc.php and /lang_web/en.js to /lang_web/ru.js, and translate it. This time we will edit /config.inc.php and edit to variables. The php array that encompass the languages in $CFG_LANGS = array("es"=>"Español","en"=>"English","ru"=>"Pусский");, adding the new, and $CFG_LANG to tell the code wich will be the default language, again $CFG_LANG = "ru";.

¡ WARNING !

We are speaking about adding a new language to the campaign stored in missions/hrcodwar/lang/codigo_nuevo_idioma.json. At the beginning of the translation file you´ll find a variable group starting by COMMAND_CHAT_xxx , this group are the key words the system detects when we send the order either through the web or on live through the chat window.
These commands must be translated with single words, WITHOUT SPACES, because the system parsers the sentence using the spaces as a way to separate the commands and then analyze each one. For instance, let say we want to translate this command from spanish to english:
"COMMAND_CHAT_HQ_MAKE_SUPPLY_COLUMN_FROM_BASE_TO_BASE" : "BASESUMINISTRO"
If we translate it this way:
"COMMAND_CHAT_HQ_MAKE_SUPPLY_COLUMN_FROM_BASE_TO_BASE" : "MAKE SUPPLY BASE COLUMN"
Never will works. Should be translated this way:
"COMMAND_CHAT_HQ_MAKE_SUPPLY_COLUMN_FROM_BASE_TO_BASE" : "MAKESUPPLYBASECOLUMN"
ó
"COMMAND_CHAT_HQ_MAKE_SUPPLY_COLUMN_FROM_BASE_TO_BASE" : "MAKE_SUPPLY_BASE_COLUMN"
Take into account, the shorter the commands the easier for the commander to manage his/her army.

The same way the command group TYPE_UNIT_NAME_xxx , Represents the internal name of the COD object in the missions and again, musn´t use spaces.