As we provide UI components in the SDK, we also need to localize some strings. We chose not to rely on an Asset Store solution and we developed a simple tool.
Our Localization tool is based on:
- The Localization window, to store your localized strings,
- The LocalizedText component, to specify the localization key for a
- The CoreApplication main component, where you list the allowed languages for your game,
- The LocalizationManager, when scripting is required.
The Localization window¶
You can access our internal tool in the Asmodee.net > Localization menu.
This tool lets you declare your localized strings via a simple key / value combination. It stores the data in
xliff files (xml format dedicated to localization).
In the top part, you are invited to Create a new localization file for each language.
Then you can explore your localized strings in three different ways:
- File by file,
- By specifying a specific Language,
- Or by looking for all localizations for a particular Key.
In the bottom part, you can export the current file in order to work with a translator.
Warning: Do not modify the strings or files we provide in the SDK. If you want to provide your own strings, simply create new files.
The LocalizedText component¶
LocalizedText component will automatically search for a
UnityEngine.UI.Text or a
TMPro.TextMeshProUGUI component attached to the same
It will automatically retrieve and set the localized string linked with the specified key parameter.
Specify allowed languages¶
You must declare Supported Languages in
CoreApplication component. Simply add the desired languages to the list.
Access the LocalizationManager by script¶
LocalizationManager is a required component of
LocalizationManager localizationManager = CoreApplication.Instance.LocalizationManager;
It will choose a default language based on
Application.systemLanguage, but you can set its
localizationManager.CurrentLanguage = LocalizationManager.Language.fr_FR;
The main service provided is
GetLocalizedText. It will retrieve the localized string based on the provided key.
string localizedString = localizationManager.GetLocalizedText("SSO.AlreadyPlayedPanel.Title");