Localization - Exit-9B/MCM-Helper GitHub Wiki

In order to support translations of your mod to different languages, you should never write user-facing text directly in scripts or MCM config layouts. This would mean that the only way to translate the mod would be to completely replace those files with alternate language versions, which would be inconvenient and go out of date with every mod update. Fortunately, there is a convenient solution to this issue.

Scaleform Translations

Scaleform, the UI framework used by the game, has a built-in capability to dynamically look up strings from a string table, based on the current language. The game stores its string translations in Data/Interface/Translate_LANGUAGE.txt, where LANGUAGE is the current game language (e.g. Translate_ENGLISH.txt). Each line in this file is a key/value pair separated by a tab stop. Each key has to start with the $ sign.

For example:

...
$Back	Back
$Backstabs	Backstabs
$Barters	Barters
...

Whenever a text field in the UI matches a key from this file, the UI replaces it with the translated value according to the current language, and displays that value to the user.

You could add your own translations by editing the game's translate files, but this would cause conflicts when multiple mods try to edit the same file.

Translations for Mods

To avoid conflicts between mods, SKSE can load translations from additional files. For each active plugin in the load order, Data/Interface/Translations/modname_LANGUAGE.txt is loaded in addition to the game's original translation tables, (e.g. SkyUI_ENGLISH.txt if the plugin is SkyUI.esp). The format of the translation table is the same as described above.


Important: The character encoding of the translation files must be UTF16 LE (aka UCS-2 LE) with BOM. Use a text editor like Sublime or Notepad++ to save with this encoding.


Be aware, however, that these translations only work, if the text field contents match the translation key exactly. Given

$Hello	Hello

"$Hello" results in "Hello", but "$Hello World" stays "$Hello World".

Loading translation files from inside a BSA file is possible. Languages the game supports are CZECH, ENGLISH, FRENCH, GERMAN, ITALIAN, POLISH, RUSSIAN, SPANISH and JAPANESE. Only the file that matches your current language is loaded; there is no fallback to ENGLISH as default.

For simple words or short sentences, you should follow the convention of naming the key the same as the translated string:

$Are you sure?	Are you sure?

For longer strings, rather pick a different key for practical reasons. You should always add a prefix that is unique to your mod in this case, to avoid name collisions with other mods:

$MYPREFIX_QUESTION1	Are you sure?\nAre you ABSOLUTELY sure you want to continue??????

You may also find that you want to define a string that the game already uses, but capitalized differently, in which case you will need to choose a different key.

$MYPREFIX_Delete	Delete

SkyUI also provides the ability to dynamically nest other text into translated strings. You can accomplish this adding {} tokens to your string. This is an example from SkyUI's translation file.

$SKI_MSG2{}	This key is already mapped to:\n{}\n\nAre you sure you want to continue?

Example

If your mod is named MyMod.esp, localize your page names by adding

$General	General
$Advanced	Advanced
$Help	Help

to Data/Interface/Translations/MyMod_ENGLISH.txt,

$General	Allgemein
$Advanced	Fortgeschritten
$Help	Hilfe

to Data/Interface/Translations/MyMod_GERMAN.txt etc.

Then, in the config menu, name your pages accordingly:

{
  ...
  "pages": [
    {
      "pageDisplayName": "$General",
      "content": [...]
    },
    {
      "pageDisplayName": "$Advanced",
      "content": [...]
    },
    {
      "pageDisplayName": "$Help",
      "content": [...]
    }
  ]
}