Skip to content
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 get_locale on IOS - OS.get_locale() and TranslationServer.get_locale() #41058

Closed
huehue-tangerine opened this issue Aug 5, 2020 · 2 comments · Fixed by #41172
Closed

Comments

@huehue-tangerine
Copy link

Godot version:
3.2.2.stable

OS/device including version:
IOS version 13.6
Iphone language: Português
Region: Brasil

Issue description:

Methods TranslationServer.get_locale() and OS.get_locale() returns inconsistent results.

In an Iphone 8 with IOS 13.6

TranslationSever.get_locale() returns: en
OS.get_locale() returns: en_BR

I think both results are wrong. The OS language is Portuguese so the method OS.get_locale() should have returned pt_BR. It returned an invalid locale (en_BR). The same problem occurred with TranslationServer.get_locale().

In an Android phone with similar configuration:
Language: Português (Brasil)

Both methods return pt_BR as result.

Steps to reproduce:

  1. Create a project with a simple call to both methods.
    print( OS.get_locale() )
    print( TranslationSever.get_locale() )

  2. Export to an IOS project

  3. Configure the iphone language to Portuguese (*)

  4. Configure the iphone region to Brazil (or Portugal) (*)(**)

  5. Install and run with xcode (to see the locale print)

(*) You can use the xcode simulator
(**) I don´t checked if the problem occurs with others countries

Minimal reproduction project:

@naithar
Copy link
Contributor

naithar commented Aug 9, 2020

Yeah, this seems to be an iOS issue with NSLocale/Locale which for some reason returns incorrect identifier for current.
This can be worked around with NSLocale/Locale.preferredLanguages.

print(Locale.current.identifier)
print(Locale.preferredLanguages)

results in

en_BR
["pt-BR", "en-BR"]

@akien-mga
Copy link
Member

Fixed by #41172.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants