[Localization 1.5.3] The parent culture is not chosen

Hello!

Why isn’t the parenting culture being chosen?

  1. I have three locales:

en, es-es, es-mx

And the strings:

en - Hello

es-es - Hola(ES)

es-mx - Hola(MX)

  1. On the android device in the settings I select es-us.

Result - the locale “en” and the string “Hello” is selected.

Expectation - the locale “es-es” and the string “Hola(ES)” is selected.

Or am I doing something wrong?



Hi,
The fallback information is not used in the platform settings, it’s only used at runtime. We don’t have control over that in Android. We can set the languages that are supported in the menu but we have no control over the way it falls back outside of Unity.
Feel free to file a bug report. We can take a closer look and see if there is something more we can do.

1 Like

confirmed

1 Like

I apologize for the stupid question😀 What is the difference between locales for example: fr and fr-fr, es and es-es, pt and pt-pt and similar?

fr is a langauge code, its French in a more general sense whereas fr-fr is a locale code, its a language code plus region. So it specifies French as used in France. Most of the time it will be the same thing but there may be times where you want to be clear about the version of the language you support.

1 Like

Got it, thanks!

Hi,
I have taken a look at the bug you filled.
This is not a bug, the issue is with Espanol (Estados Unidos). This is a regional locale for the US (es-US).
es-US will fall back to the non-regional version of Spanish(es). In your project you have 2 regional Spanish locales es-ES (Spain) and es-MX (Mexico).
The default fallbacks would look like this:

  graph TD;
      A[es]-->B[es-ES];
      A[es]-->C[es-MX];
      A[es]-->D[es-US];

Your project does not include es so it falls back to the Specific Locale Selector.

To solve this I would Introduce a Spanish (es) locale, maybe use it to replace the es-ES one, so that all variations of Spanish can fallback to it:

Can I clarify if I have understood correctly

If a language is selected on the device - es-US, es-AR, es-BO… and these locales are not added to the project, then SystemLocaleSelector will select the ‘es’ locale if it is in the project, but will never select ‘es-ES’ if ‘es’ is not in the project?

And following the same logic for example for the French language:

If the language selected on the device is fr-BE, fr-CE, fr-CH… and these locales are not added to the project, then SystemLocaleSelector will select the locale ‘fr’ if it is in the project, but will never select ‘fr-FR’ if ‘fr’ is not in the project?

Yes thats correct. The fallbacks are taken from the CultureInfo, if we cant find a matching locale we work our way through the Parent cultures until we find one or we stop and let the next Locale Selector try.

So whilst Spanish(Spain) may be a similiar locale to Spanish(Mexico), its not a parent locale so we dont know if it should be used. There are differences between the 2 languages that may not be suitable to use by default, for example some words in Spain may have different meanings in Mexico.

You can customize the way we fallback either through the Locale or by adding a custom StartupLocaleSelector.

1 Like

Thank you, I understand.

1 Like