Initial Language Spanish (Mexico) not detected
6 years 8 months ago #2939
by dwebb
Replied by dwebb on topic Initial Language Spanish (Mexico) not detected
Hi,
When I select Espanol (Latinoamerica) on iOS, the device thinks the iso is es-419, which picks Es over Es-US, any way of fixing this?
IPad ios: 11.2.2
I2 v2.8.5 f1
Thanks,
Dave
When I select Espanol (Latinoamerica) on iOS, the device thinks the iso is es-419, which picks Es over Es-US, any way of fixing this?
IPad ios: 11.2.2
I2 v2.8.5 f1
Thanks,
Dave
Please Log in or Create an account to join the conversation.
6 years 8 months ago - 6 years 8 months ago #2940
by enghoff
Replied by enghoff on topic Initial Language Spanish (Mexico) not detected
I worked around the issue by integrating
assetstore.unity.com/packages/tools/inte...precise-locale-65836
with LocalizationManager_SystemLanguage.cs
public static partial class LocalizationManager
{
static string mCurrentDeviceLanguage;
public static string GetCurrentDeviceLanguage()
{
if (string.IsNullOrEmpty(mCurrentDeviceLanguage))
DetectDeviceLanguage();
return mCurrentDeviceLanguage;
}
static void DetectDeviceLanguage()
{
switch (PreciseLocale.GetLanguageID())
{
case "es_MX":
case "es_US":
mCurrentDeviceLanguage = "Spanish (Mexico)";
break;
case "pt_BR":
mCurrentDeviceLanguage = "Portuguese (Brazil)";
break;
default:
mCurrentDeviceLanguage = Application.systemLanguage.ToString();
if (mCurrentDeviceLanguage == "ChineseSimplified") mCurrentDeviceLanguage = "Chinese (Simplified)";
if (mCurrentDeviceLanguage == "ChineseTraditional") mCurrentDeviceLanguage = "Chinese (Traditional)";
break;
}
}
}
Last edit: 6 years 8 months ago by enghoff. Reason: Formatting
The following user(s) said Thank You: studenman
Please Log in or Create an account to join the conversation.
6 years 8 months ago #2941
by studenman
Replied by studenman on topic Initial Language Spanish (Mexico) not detected
This is a useful plugin, I was not aware that Application.systemLanguage didn't return precise regions (like es-MX and en-GB).
I'm currently using "es" to be all Latin-America and Mexico regions and es-ES for European Spanish. Seems like most of the "es" language region variations would be most similar to Mexico rather than to European Spanish.
Based upon your suggestion and the code in I2L v2.8.5f1, I've changed DetectDeviceLanguage() like this. Thoughts?
I'm currently using "es" to be all Latin-America and Mexico regions and es-ES for European Spanish. Seems like most of the "es" language region variations would be most similar to Mexico rather than to European Spanish.
Based upon your suggestion and the code in I2L v2.8.5f1, I've changed DetectDeviceLanguage() like this. Thoughts?
static void DetectDeviceLanguage()
{
var code = PreciseLocale.GetLanguageID();
if (!string.IsNullOrEmpty(code))
{
code = code.Replace('_', '-');
mCurrentDeviceLanguage = GoogleLanguages.GetLanguageName(code, true, true);
if (!string.IsNullOrEmpty(mCurrentDeviceLanguage))
return;
}
mCurrentDeviceLanguage = Application.systemLanguage.ToString();
if (mCurrentDeviceLanguage == "ChineseSimplified") mCurrentDeviceLanguage = "Chinese (Simplified)";
if (mCurrentDeviceLanguage == "ChineseTraditional") mCurrentDeviceLanguage = "Chinese (Traditional)";
}
Please Log in or Create an account to join the conversation.
6 years 8 months ago #2944
by enghoff
Replied by enghoff on topic Initial Language Spanish (Mexico) not detected
To me that looks as a likely valid general solution
Please Log in or Create an account to join the conversation.
Time to create page: 0.144 seconds