Jump to content

Language Detection


jwatson

Recommended Posts

Hello,

 

Is there a way to get the headset language selected from the Focus 3 Lobby in Unity. We're looking mostly at the distinction between Spanish (Latin America) vs Spanish (Spain)  since application.SystemLanguage does not show a distinction between the two when selected in application.  

 

Thanks!

Link to comment
Share on other sites

Hi @jwatson,

You can use below code to get the language and country to differentiate between Spanish (Latin America) and Spanish (Spain).

string GetSystemLanguage()
{
	AndroidJavaClass lc = new AndroidJavaClass("java/util/Locale");
	AndroidJavaObject dl = lc.CallStatic<AndroidJavaObject>("getDefault");
	string language = dl.Call<string>("getLanguage");
	string country = dl.Call<string>("getCountry");

	return language + "-" + country;
}

For Spanish (Latin America), you will get es-419.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...