-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent locale string between platforms #40703
Comments
It's normal that the locale is different, even on the same OS you can have one using What you need is #37246. |
@bruvzg #40708 makes this clear in the documentation, but I guess there might still be a use case to provide users with the language code only if they're not interested in all the extras. Currently they'd have to do Could be |
Maybe it's better to have a few locale matching functions: |
I feel that's a bit too complex to use for most users. A case I was just told about was trying to index a dictionary (I suppose) using
IMO something simple like |
This method extracts the 2 or 3-letter language code from `OS::get_locale()`, making it easier for users to identify the "main" language code for users that might have different OS locales due to different OS or region, but should be matched to the same translation (e.g. "generic" Spanish). Fixes godotengine#40703.
This method extracts the 2 or 3-letter language code from `OS::get_locale()`, making it easier for users to identify the "main" language code for users that might have different OS locales due to different OS or region, but should be matched to the same translation (e.g. "generic" Spanish). Fixes godotengine#40703. (cherry picked from commit def99c7)
This method extracts the 2 or 3-letter language code from `OS::get_locale()`, making it easier for users to identify the "main" language code for users that might have different OS locales due to different OS or region, but should be matched to the same translation (e.g. "generic" Spanish). Fixes godotengine#40703. (cherry picked from commit def99c7)
This method extracts the 2 or 3-letter language code from `OS::get_locale()`, making it easier for users to identify the "main" language code for users that might have different OS locales due to different OS or region, but should be matched to the same translation (e.g. "generic" Spanish). Fixes godotengine#40703. (cherry picked from commit def99c7)
Godot version:
3.2.3 rc1
Issue description:
So I had this piece of code in my game:
It worked fine on Windows, but always returned the latter string on Android. As it turned out, on Android the returned locale is
pl_PL
. Now, this is platform-specific (OS and stuff), so let's say it's ok. But then there'sTranslationServer.get_locale()
, which has exactly the same problem and it's not ok. My bizarre finding is that when you useTranslationServer.set_locale()
, theget_locale()
method will return the string you just set (not sure about OS). This is evident by the fact that my code above worked when I replaced OS with TranslationServer and then changed language toen
and back topl
(which overrodepl_PL
withpl
).Sooo... TranslationServer should be platform-independent when being queried for locale. Or at least the documentation should mention the intended way to check current locale.
Steps to reproduce:
Run it on different platforms and compare the results.
The text was updated successfully, but these errors were encountered: