Table of Contents

Localizations

It is possible to provide additional translations for the game. The strings are stored in precompiled .mo libraries. They can be found in the res/strings/ folder. There is a subfolder for each natively supported language: de for German, en for English, …, zh_CN for Simplified Chinese and zh_TW for Traditional Chinese. The folders are named as <language>_<region> where

For example de is the general German and fallback for all other german translations while de_CH is Swiss German and de_AT is Austrian German.

Inside each folder, there is a info.lua file and a LC_MESSAGES/ folder. The info.lua contains some meta information:

function data()
return {
  name = "German",
  locale = "de_CH",
  fontMap = {
    regular = "Lato2OFL/Lato-Regular.ttf",
    bold = "Lato2OFL/Lato-Bold.ttf",
    monoRegular = "Noto/NotoSansMono-Regular.ttf",
    monoBold = "Noto/NotoSansMono-Bold.ttf",
  },
}
end

The properties are:

In the LC_MESSAGES/ folder, there are two files:

A mod that provides additional translations needs to contain a structure analogue to the default languages with the info.lua and the LC_MESSAGES/ folder.

Translation

The translation is a three step process:

  1. Decompiling the .mo files to .po files that are editable
  2. Editing the translation
  3. Compiling the .po files to .mo files that are usable by the game

Decompiling

To start a new translation, it's recommend to base on the default translation. There are some tools that can be used to decompile the .mo files:

To convert with that tool, install Poedit. Then you can find a msgunfmt.exe in the installation subfolder Poedit/GettextTools/bin/. Execute path/to/msgunfmt.exe “path/to/xyz.mo” -o “path/to/xyz.po” in a command line interface to convert the file.

Editing

The .po file can be opened by any text editor. For more convenience, programs like Poedit itself can be used to edit the files.

Make sure to set the correct target language. This can be done in Catalogue > Properties at the Language dropdown.

The editor consists of three big areas:

Compiling

Once the translation should be compiled, either use Poedit File > Compile to MO… or execute path/to/msgunfmt.exe “path/to/xyz.po” -o “path/to/xyz.mo” in a command line interface to convert the file into .mo format.

Updating

With new game releases, there may come new strings too. You can use Poedit to merge new key strings from an updated PO file into yours. Select Catalog > Update from POT file from the menu.

Support additional Languages in Mods

To support additional languages in mods, simply add another table with the identifier from the locale property in the strings.lua:

function data()
return {
  en = {
    ["modname_name"] = "Urban Games Translation Demo",
    ["modname_desc"] = "This mod shows an exemplaric translation",
  },
  de = {
    ["modname_name"] = "Urban Games Übersetzungsdemo",
    ["modname_desc"] = "Diese Mod zeigt eine beispielhafte Übersetzung",
  },
  de_ch = {
    ["modname_name"] = "Urban Games Öbersetzigsdemo",
    ["modname_desc"] = "Die Mod zeigt es guets Bispel för en Öbersetzig",
  },
  ...
}