Property LocaleOverride
LocaleOverride
Provide a locale that can be used instead of SelectedLocale. A null value will revert to using SelectedLocale.
Declaration
public Locale LocaleOverride { get; set; }
Property Value
Type | Description |
---|---|
Locale |
Examples
This example shows how the LocaleOverride can be used in order to provide an alternative to SelectedLocale.
public class LocaleOverrideExample : MonoBehaviour
{
public LocalizedString myString = new LocalizedString("My Table", "My Entry");
public LocaleIdentifier localeOverride = SystemLanguage.Spanish; // Override to always use Spanish
IEnumerator Start()
{
// Wait for the Locales to load.
yield return LocalizationSettings.InitializationOperation;
// Set the LocalizedString to use the locale override instead of the selected locale.
myString.LocaleOverride = LocalizationSettings.AvailableLocales.GetLocale(localeOverride);
}
void OnGUI()
{
GUILayout.Label(myString.GetLocalizedString());
}
}