I have a webgl project with language localization. In unity, it changes the language depending on what language format is in the window. But in the browser, he puts the language that is in the browser. How to change the language in the browser from the language format in windows
[SerializeField] private Dropdown dropdown;
public void SetLanguage(int value)
{
Lean.Localization.LeanLocalization.CurrentLanguage = value == 0 ? "Russian" : "English";
}
private string DefineCurrentLanguage()
{
if (Application.systemLanguage == SystemLanguage.Russian)
{
Debug.Log("This system is in Russian. ");
return "Russian";
}
else if (Application.systemLanguage == SystemLanguage.English)
{
Debug.Log("This system is in English. ");
return "English";
}
else
{
Debug.Log("System Language not defined. ");
return "English";
}
}
private void SetLanguage(string lang)
{
Lean.Localization.LeanLocalization.CurrentLanguage = lang;
}
private void Awake()
{
SetLanguage(DefineCurrentLanguage());
dropdown.value = Lean.Localization.LeanLocalization.CurrentLanguage == "Russian" ? 0 : 1;
}
}