Issue with Locale Selectors

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).


@karl_jones I checked what the CultureInfo.CurrentUICulture and the CultureInfo.CurrentCulture returns, and it’s always en-US; I don’t know why :eyes:

1 Like

Is this in the editor or player build that you have this problem?

Both of them, I get en-US in the editor and player.

And your operating system language is French?
What does Application.systemLanguage return?

Yes, my OS is in French (France), and Application.systemLanguage returns French, as expected. (in editor and player).

Sounds like a unity bug. Could you please file a bug report regarding the Culture Info not being correct?

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.

1 Like

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?

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.

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):

using System.Collections;
using UnityEngine;
using UnityEngine.Localization.Settings;

public class LocalizationLoader : MonoBehaviour
{
    private IEnumerator Start()
    {
        yield return LocalizationSettings.InitializationOperation;
        var systemLanguage = Application.systemLanguage;

        if (systemLanguage != SystemLanguage.Unknown)
        {
            var locale = LocalizationSettings.AvailableLocales.GetLocale(systemLanguage);
            if (locale != null)
            {
                Debug.Log($"Set Locale: {locale}");
                LocalizationSettings.SelectedLocale = locale;
            }
        }
    }
}
1 Like

Any updates?

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.