Using Application.systemLanguage returns Unknown

On Android if I get the string of .systemLanguage while my phone is set to German it returns unknown.
Is there some other way to get the language? Or is there some issue with Unity?

I’m feeling it is something with Unity as I am partly sure I have had my localisation swapping dependant on what language my phone was set to.

If it is just broken in Unity how else can I get the devices language?

Edit:
I’m using the Nexus 4 (Android 4.3) with Unity 4.3.0f4

Well, just tried it on my Nexus7 and it worked well. However i still use Unity 4.3.4f1 but i’m just downloading Unity 4.5.1 as i write this :wink:

Keep in mind that systemLanguage isn’t a string! It’s a enum. However if you “concat” a string with an enum value it will be converted to a string:

    GUILayout.Label("systemLanguage :"+Application.systemLanguage);

This prints “systemLanguage :German” for me. I usually have set the language to English and it also prints correctly if i set the language to English.

edit
Just installed Unity 4.5.1f3 and it still works for me just fine. You might want to try my MobileStats app (just made a fresh build) and see if it works for you. I added the system language as the last point in the general info box.

second edit

I just wrote two helper functions which uses the JNI interface to query the system language directly from the JAVA environment:

// C#
// returns "en" / "de" / ...
public static string GetLanguage()
{
	#if UNITY_ANDROID
	try
	{
		var locale = new AndroidJavaClass("java.util.Locale");
		var localeInst = locale.CallStatic<AndroidJavaObject>("getDefault");
		var name = localeInst.Call<string>("getLanguage");
		return name;
	}
	catch(System.Exception e)
	{
		return "Error";
	}
	#else
	return "Not supported";
    #endif
}

// returns "eng" / "deu" / ...
public static string GetISO3Language()
{
	#if UNITY_ANDROID
	try
	{
		var locale = new AndroidJavaClass("java.util.Locale");
		var localeInst = locale.CallStatic<AndroidJavaObject>("getDefault");
		var name = localeInst.Call<string>("getISO3Language");
		return name;
	}
	catch(System.Exception e)
	{
		return "Error";
	}
	#else
	return "Not supported";
	#endif
}