How can i check with if, what the system language is?
Example, but dont work:
if (SystemLanguage.German) {
Debug.Log ("This is a german Device");
}
if (!SystemLanguage.German) {
Debug.Log("This is not a german Device");
}
How can i check with if, what the system language is?
Example, but dont work:
if (SystemLanguage.German) {
Debug.Log ("This is a german Device");
}
if (!SystemLanguage.German) {
Debug.Log("This is not a german Device");
}
SystemLanguage.German is an enumeration. If you want to check the language the user’s operating system is running in, you need to use Application.systemLanguage and compare to the enumeration that you want.
You can show the system language like this
Debug.Log("Application.systemLanguage = " + Application.systemLanguage.ToString());
If you just want to check for a single language like you mentioned above you can do this
if (Application.systemLanguage == SystemLanguage.German)
{
Debug.Log("This is a German Device");
}
else
{
Debug.Log("This is not a German Device");
}
or you can check for multiple languages like this
switch (Application.systemLanguage)
{
case SystemLanguage.Chinese:
{
// do something
break;
}
case SystemLanguage.Danish:
{
// do something
break;
}
case SystemLanguage.Dutch:
{
// do something
break;
}
case SystemLanguage.English:
{
// do something
break;
}
case SystemLanguage.Finnish:
{
// do something
break;
}
case SystemLanguage.French:
{
// do something
break;
}
case SystemLanguage.German:
{
// do something
break;
}
case SystemLanguage.Greek:
{
// do something
break;
}
case SystemLanguage.Japanese:
{
// do something
break;
}
default:
{
// do something
break;
}
}