Search Unity

Question Issue with Locale Selectors

Discussion in 'Localization Tools' started by erlemaitre, Feb 4, 2021.

  1. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Hello,
    I'm currently working with the localization package, and I need some help with the locale selectors. I created my game for English and French languages (en, en-GB, en-US, fr), but I can't get the locale selectors working. For now, only the SpecificLocaleSelector seems to put the game in French when it is placed as the first selector, but the CommandLineSelector and the SystemLocaleSelector both put my game in English (my system is in French).
    LocalizationSettings.png
    @karl_jones I checked what the CultureInfo.CurrentUICulture and the CultureInfo.CurrentCulture returns, and it's always en-US; I don't know why o_O
     
    Mobazy likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Is this in the editor or player build that you have this problem?
     
  3. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Both of them, I get en-US in the editor and player.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
  5. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Yes, my OS is in French (France), and Application.systemLanguage returns French, as expected. (in editor and player).
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Sounds like a unity bug. Could you please file a bug report regarding the Culture Info not being correct?
     
  7. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Yes, I get the same culture code and system language with an empty Unity project, it's definitely a bug within Unity. I submitted a bug report.
     
    karl_jones likes this.
  8. Mobazy

    Mobazy

    Joined:
    Jan 27, 2018
    Posts:
    9
    This bug is NOT resolved in the latest version 1.0.0-pre.9 - May 12, 2021. The Locale Selector, "System Locale Selector" always returns en-us when using an iOS or Android device.

    Is this bug still being worked on?
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    I think the solution was to upgrade to the latest addressables. If not please file a bug report.
    I'm not in the office at the moment so can't check.
     
  10. Mobazy

    Mobazy

    Joined:
    Jan 27, 2018
    Posts:
    9
    Karl I updated to the latest addressables, but it still always returns 'en-US'. I filed a bug.

    Also I found a work-around in another thread (this doesn't work for android):

    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using UnityEngine.Localization.Settings;
    4.  
    5. public class LocalizationLoader : MonoBehaviour
    6. {
    7.     private IEnumerator Start()
    8.     {
    9.         yield return LocalizationSettings.InitializationOperation;
    10.         var systemLanguage = Application.systemLanguage;
    11.  
    12.         if (systemLanguage != SystemLanguage.Unknown)
    13.         {
    14.             var locale = LocalizationSettings.AvailableLocales.GetLocale(systemLanguage);
    15.             if (locale != null)
    16.             {
    17.                 Debug.Log($"Set Locale: {locale}");
    18.                 LocalizationSettings.SelectedLocale = locale;
    19.             }
    20.         }
    21.     }
    22. }
     
    Last edited: Jun 27, 2021
    karl_jones likes this.
  11. Kkitar

    Kkitar

    Joined:
    Jan 14, 2019
    Posts:
    2
    Any updates?
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    I did see some bug fixes recently regarding the .net system locale that may fix some issues. The best thing to do is file bug reports to be sure it addresses your problem.