Skip to content

Internationalization

NAL edited this page Jun 27, 2020 · 3 revisions

Usage of I18n

You can access the i18n system with two methods.

  1. Placeables have an "_i18nNameKey" and an "_i18nDescKey" which are the reference to the i18n Name and i18n Description of the object.
  2. Using the (to be added) i18n Class from the SimAirport.Modding library.

In both cases you'll have to specify what key you want to get. A key is defined by the path to the node separated by dots '.'.

For example, the Bench object's i18n is found in the Entities.xml and it's key is Entities.Objects.Bench.name, this describes how to get to the actual string inside the xml file.

Custom I18n

To add custom translations or custom naming to your mod you need to add a new xml file in your i18n folder.

The name of the xml file will determine which language the xml is used for (e.g. "en.xml" => English, "de.xml" => German). The English translation will be used if no translation is given for a key.

The xml file can be structured as you want, the only limitation is duplication, it is not possible to "overwrite" another key! If your xml contains a key that another mod already added or the game already uses in the base translation your mod may fail to load!

It is recommended to have your name as the root node, this ensures that no key will be the same between two mods!

Example mod xml:

<Olaf>
    <MyMod>
         <myBenchCustomName>Super bench</myBenchCustomName>
    </MyMod>
<Olaf>

The key for this example bench would be Olaf.MyMod.myBenchCustomName.