Skip to content

Runtime changing language

Rodion Lodza edited this page Oct 25, 2020 · 2 revisions

Call the method to change the language Localizator.ChangeLanguage(SystemLanguage language).

Important! Don't forget to subscribe custom scripts that use the localizer for the event Localizator.OnLanguageChanged.

Example

using SimpleLocalization;
using UnityEngine.UI;
using UnityEngine;

public class DynamicText : MonoBehaviour
{
    [SerializeField] private Text someText = null;

    private void Start()
    {
        Localizator.OnLanguageChanged += SetText;
        SetText();
    }

    private void SetText()
    {
        someText.text = Localizator.Translate("diamonds");
    }
}

Clone this wiki locally