************ Localization ************ 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 ``UnityEngine.UI.Text`` or a ``TMPro.TextMeshProUGUI`` component, - 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. .. image:: ../Images/localization-image1.png :align: center 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. .. image:: ../Images/localization-image2.png :align: center The LocalizedText component --------------------------- The ``LocalizedText`` component will automatically search for a ``UnityEngine.UI.Text`` or a ``TMPro.TextMeshProUGUI`` component attached to the same ``GameObject``. It will automatically retrieve and set the localized string linked with the specified **key** parameter. .. image:: ../Images/localization-image4.png :align: center Specify allowed languages ------------------------- You must declare **Supported Languages** in ``CoreApplication`` component. Simply add the desired languages to the list. .. image:: ../Images/localization-image3.png :align: center Access the LocalizationManager by script ---------------------------------------- ``LocalizationManager`` is a required component of ``CoreApplication``. .. code:: csharp LocalizationManager localizationManager = CoreApplication.Instance.LocalizationManager; It will choose a default language based on ``Application.systemLanguage``, but you can set its ``CurrentLanguage``. .. code:: csharp localizationManager.CurrentLanguage = LocalizationManager.Language.fr_FR; The main service provided is ``GetLocalizedText``. It will retrieve the localized string based on the provided key. .. code:: csharp string localizedString = localizationManager.GetLocalizedText("SSO.AlreadyPlayedPanel.Title");