Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug (Case 1376680) Localization: Hindi system language not detected

Discussion in 'Localization Tools' started by Peter77, Oct 28, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    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
    1. Open attached project
    2. Open "File > Build Settings..." and switch to Android build target
    3. Open "Window > Asset Management > Addressables > Groups"
    4. Click in Addressables Groups window "Build > New Build > Default Build Script"
    5. Click "File > Build and Run" and run the app on your Android phone
    6. On your Android phone, open Language Settings and activate "Hindi" language
    7. 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).
     

    Attached Files:

  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    Ah I suspect this is similar to the iOS issue. I plan to look at them both tomorrow.
     
    Peter77 likes this.
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    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` 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.
     
    Peter77 likes this.
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    Thank you, that's really great. Do you happen to know if it's the same thing why Hindi isn't working on iOS?
     
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    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.
     
    Peter77 likes this.
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    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?

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

    Attached Files:

  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    Does it display the Hindi app name?
     
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    Yes it does display the Hindi app name.
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    Is this 2019.4?
    Are you a able to try 2021.2?
     
  10. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    It's 2019.4, I can test it for you with 2021.2, but I ultimately need it to work in 2019.4.
     
  11. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    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.
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    Thats strange. I did test with Hindi when I looked at it.
    What does Application.systemLanguage and CultureInfo.CurrentUICulture return?
     
  13. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    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
    .

    Code (CSharp):
    1. var sb = new System.Text.StringBuilder();
    2. sb.Append($"Application.systemLanguage: {Application.systemLanguage}\n");
    3. sb.Append($"CurrentThread.CurrentCulture: {System.Threading.Thread.CurrentThread.CurrentCulture.Name}\n");
    4. sb.Append($"CurrentThread.CurrentUICulture: {System.Threading.Thread.CurrentThread.CurrentUICulture.Name}\n");
    5. sb.Append($"CultureInfo.CurrentCulture: {System.Globalization.CultureInfo.CurrentCulture.Name}\n");
    6. sb.Append($"CultureInfo.CurrentUICulture: {System.Globalization.CultureInfo.CurrentUICulture.Name}\n");
    7. m_Text.text = sb.ToString();
    Here is a screenshot with Hindi system language:
    device_hindi.png


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

    Attached Files:

  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    That's weird. I tested using the android emulator so maybe it works differently than normal android. I'll give it another look
     
    Peter77 likes this.
  15. Lukas-Labaj

    Lukas-Labaj

    Joined:
    Nov 22, 2012
    Posts:
    37
  16. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    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 :(
     
  17. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    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
    upload_2021-11-11_15-29-0.png

    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?
     
  18. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    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).
     
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    Ah that's a good catch, can't believe I missed that.
     
    Peter77 likes this.
  20. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    Ok Bug confirmed :)
     
    Peter77 likes this.
  21. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    Last edited: Nov 12, 2021
    denis_bogdanov and karl_jones like this.
  22. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    Hey Karl, I saw the issue is fixed in 1.1.0. Thank you! I wonder if it just works or requires to upgrade Unity. I'm using 2019.4.20f1.
     
  23. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,392
    The fix is part of the package in 1.1.0 so will require upgrading the package. It should work with any Unity version that supports the package, you dont need any Unity editor changes.
     
    sandolkakos and Peter77 like this.