Improve locale comparison#98743
Conversation
22495ae to
4a272e8
Compare
|
When matching When matching |
Wow, that is very unusual. It's because of the this part that sets the script and/or country when comparing locales:
In other words, |
4a272e8 to
954508f
Compare
|
I added test cases for |
Since 9456454, country specific locales are always preferred over country-less locales even when the OS locale country doesn't match. For example, running the Godot editor with locale es_ES will result in the es_AR locale being chosen even though the es locale would be better. The change happened because the score of the es_AR locale and the es locale are the same when comparing to es_ES. Change this by parsing locale strings into a Locale structure and decreasing the score when script, country or variant are set in both but not matched. For the es_ES case, this causes the es_AR score to be decreased since the countries don't match. On the other hand, the es locale is not decreased since it doesn't specify a country.
954508f to
2dd409f
Compare
#98972 addresses that (and will likely cause a conflict with this if merged). |
|
Thanks! |
Since 9456454, country specific locales are always preferred over country-less locales even when the OS locale country doesn't match. For example, running the Godot editor with locale es_ES will result in the es_AR locale being chosen even though the es locale would be better.
The change happened because the score of the es_AR locale and the es locale are the same when comparing to es_ES. Change this by parsing locale strings into a Locale structure and decreasing the score when script, country or variant are set in both but not matched. For the es_ES case, this causes the es_AR score to be decreased since the countries don't match. On the other hand, the es locale is not decreased since it doesn't specify a country.
Fixes: #90677