Action denied

Localisation

l10n is a shorthand notation for localisation, which allows players from different countries to play the game in their native language. It may be helpful to understand the basics of Localisation in Winter Resort Simulator if you want to create mods in more than one language.

In general, we strongly recommend to use localisation, even if you are just working on one language. It can happen that members of the community volunteer to translate your mod, therefore it is good to already use localisation from the very beginning on.

Basic Concept

The basic concept is simple: The localisation system stores many strings (i.e. texts). You can register each string in multiple languages, and game will automatically return the correct language as defined by the player.

The game's main languages are:

  • en : English (Default and fallback language)
  • de : German

Additionally, there are four translations available:

  • es : Spanish
  • pl : Polish
  • fr : French
  • it : Italian

In case a text is not available in the language selected by the player, the game will automatically fall back to the English text. Therefore, please make sure that you always register all keys in English as well!

Lua Functions

l10n.add(language, key, value)

Registers a text in the given language (string, e.g. en). The text will be identified by its key (string) and its value (returned e.g. by l10n.get()) will be equal to value (string).

function l10n.add(language, key, value) 

l10n.get(key, fallback)

Returns the correct translation for key. If the text cannot be found, fallback (optional string) will be returned. In case no fallback is specified, it will return l10n/key.

function l10n.get(key, fallback) 

l10n.getDollar(key)

Depending on key (string), the function will

  • return l10n.get(key:sub(2)) if key starts with a dollar sign ($), or otherwise
  • return key.

Using this function, it is possible to allow both untranslated text (starting with any letter or character except $) and translated texts (starting with $ and then containing the text's key).

function l10n.getDollar(key) 

l10n.getLanguage()

Returns the currently active language (e.g. en, de, etc.).

function l10n.getLanguage() 

l10n.getSystemLanguage()

Returns the user's system language (e.g. en, de, etc.).

function l10n.getSystemLanguage() 

l10n.setLanguage(language)

Sets the currently active language to language. Note that this will not change any texts that have been translated before changing the language (those will remain in the previously active language).

function l10n.setLanguage(language) 

l10n.getMetreString(value)

Displays a length of value metres (float) in the appropriate form for the currently active language, i.e. a value of 1 will be translated as

  • 3.28 ft in case the current language is en and
  • 1.00 m for all other languages.
function l10n.getMetreString(value) 

All contents of this page may be used for modding use for Winter Resort Simulator - Season 2 only. Any use exceeding this regulation is not permitted.

Copyright (C) HR Innoways, 2021. All Rights Reserved.