(Case 1376680) Localization: Hindi system language not detected

Unity 2019.4.29f1, Localization 1.0.4, Addressables 1.19.6

The Localization package does not detect if Hindi is used as system language on an Android device. The Localization system uses English instead.

Reproduce

  • Open attached project
  • Open “File > Build Settings…” and switch to Android build target
  • Open “Window > Asset Management > Addressables > Groups”
  • Click in Addressables Groups window “Build > New Build > Default Build Script”
  • Click “File > Build and Run” and run the app on your Android phone
  • On your Android phone, open Language Settings and activate “Hindi” language
  • Restart app on your Android phone

Actual
The text displays “English”

Expected
The text displays “Hindi”

Note
I don’t know what other languages are not detected and I also don’t know what other platforms have this problem. It would be good if you would perform this test with all locales that the Localization system supports and different platforms (Android and iOS at least).

7611451–945610–bugreport_1376680.zip (80.9 KB)

Ah I suspect this is similar to the iOS issue. I plan to look at them both tomorrow.

1 Like

Hey just took a look at this. The problem is that the Android app needs to be configured to tell Android what languages it supports. If you dont then it falls back so we never even get told that you want Hindi. Fortunately we already support this, you can fix it by adding the [Android App Info](https://docs.unity3d.com/Packages/com.unity.localization@1.0/manual/Android-App-Localization.html) metadata to the LocalizationSettings. Configure the localized app name and it will then work correctly. I have added a warning when building without app info in the next release.

1 Like

Thank you, that’s really great. Do you happen to know if it’s the same thing why Hindi isn’t working on iOS?

No for iOS we didn’t detect the preferred language for the app and only checked the system language. I have a fix for this which should be available in the next release.

1 Like

Hey Karl, thank you for the help.

I can’t get it to work. I’m testing on a Samsung Galaxy S6 with Android 7.0. When I set the system language to Hindi, the attached project still displays English. It does work with German though, but it doesn’t work with Hindi.

What am I doing wrong?

7639738--951658--upload_2021-11-8_20-26-41.png

7639738–951661–bugreport_1376680_updated.zip (81.1 KB)

Does it display the Hindi app name?

Yes it does display the Hindi app name.

Is this 2019.4?
Are you a able to try 2021.2?

It’s 2019.4, I can test it for you with 2021.2, but I ultimately need it to work in 2019.4.

I tested it with 2021.2.1f1 and it’s the same problem. The app name is localized, but in the Player it displays English instead of Hindi. It does work with other languages, such as German, just fine though.

Thats strange. I did test with Hindi when I looked at it.
What does Application.systemLanguage and CultureInfo.CurrentUICulture return?

Unity 2021.1.1f1, Localization 1.0.4, Addressables 1.19.9, Samsung Galaxy S6, Android 7.0

Application.systemLanguage does not have a Hindi enumerated member, so it returns Unknown. CultureInfo methods don’t work on Android and iOS as mentioned in the other thread , so they return "" (empty string) for CultureInfo.Name and "iv" for CultureInfo.TwoLetterISOLanguageName.

var sb = new System.Text.StringBuilder();
sb.Append($"Application.systemLanguage: {Application.systemLanguage}\n");
sb.Append($"CurrentThread.CurrentCulture: {System.Threading.Thread.CurrentThread.CurrentCulture.Name}\n");
sb.Append($"CurrentThread.CurrentUICulture: {System.Threading.Thread.CurrentThread.CurrentUICulture.Name}\n");
sb.Append($"CultureInfo.CurrentCulture: {System.Globalization.CultureInfo.CurrentCulture.Name}\n");
sb.Append($"CultureInfo.CurrentUICulture: {System.Globalization.CultureInfo.CurrentUICulture.Name}\n");
m_Text.text = sb.ToString();

Here is a screenshot with Hindi system language:
7640770--951928--device_hindi.png

Here is a screenshot with German system language:
7640770--951925--device_german.png

7640770–951931–bugreport_1376680_updated2.zip (91 KB)

That’s weird. I tested using the android emulator so maybe it works differently than normal android. I’ll give it another look

1 Like

I think there is an issue with CurrentCulture info (on iOS and Android) in Unity in general. For that reason I had to write my custom language selector as Localizations’ selector in package doesnt work properly.

see also : CultureInfo.CurrentCulture always returning Invariant Language (Invariant Country)

I think part of the issue was that the app was not configured correctly so CultureInfo would not return the correct language. It does work correctly on iOS, our QA have verified it for me. We only support the system language at the moment on iOS but will have preferred app language support in 1.1.
For Android, I’m still waiting for some more feedback from QA? When I tested using an emulator it worked fine after configuration but it seems like devices are not working :frowning:

QA has not been able to reproduce this. They tested with 2019.4 and 2020.3.
The issue did occur however once they added the Android App Info and configured the Display Name it worked as expected

They tested with a few different devices including some Android 7 ones.
So im not sure why its not working for you unless there’s some step we are not doing?

Thank you for the reply.

According to your screenshot, your fallback is Hindi. So even when “System Locale Selector” doesn’t detect the system Hindi language, which is what I reported, the “Specific Locale Selector” will set it to Hindi regardless.

In the project I submitted, the “Project Locale Identifier” and “Specific Locale Selector” are both “English” instead of Hindi. Please use the project I attached to the bug-report without any modifications (other than adding the Android App Info metadata).

I’m able to reproduce this issue across different devices Android/iOS with different OS versions. All I have to do to reproduce the issue is to open the project from Case 1376680, build for Android and run it on a real device (not an emulator).

Ah that’s a good catch, can’t believe I missed that.

1 Like

Ok Bug confirmed :slight_smile:

1 Like