I need to get the locale the game is currently set to. I mean I need to get it inside a script. I’ve googled and found no results. I only found Application.systemLanguage which returns the language of the user’s device.
1 Like
LocalizationSettings.SelectedLocale
Or the async version
https://docs.unity3d.com/Packages/com.unity.localization@1.2/api/UnityEngine.Localization.Settings.LocalizationSettings.html#UnityEngine_Localization_Settings_LocalizationSettings_SelectedLocaleAsync
1 Like
So if I wanted to, for example, know if the locale is french how would I do this?
LocalizationSettings.SelectedLocale returns the current Locale
You could check the Locale Identifier to see the name or code.
The French code would be “fr”.
I found the solution to be this:
Locale currentSelectedLocale = LocalizationSettings.SelectedLocale;
ILocalesProvider availableLocales = LocalizationSettings.AvailableLocales;
if (currentSelectedLocale == availableLocales.GetLocale("fr")
{
}
9 Likes