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).
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.
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.
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.
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.
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();
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.
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
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?
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).