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

HTML5: OS.get_locale() uses hyphens instead of underscores #63029

Closed
pattlebass opened this issue Jul 15, 2022 · 2 comments · Fixed by #63043
Closed

HTML5: OS.get_locale() uses hyphens instead of underscores #63029

pattlebass opened this issue Jul 15, 2022 · 2 comments · Fixed by #63043

Comments

@pattlebass
Copy link
Contributor

Godot version

v3.5.beta.custom_build [6d9cbcb]

System information

Windows 10, Chrome 103

Issue description

According to the docs, OS.get_locale() should return a string of the form language_Script_COUNTRY_VARIANT@extra (notice the underscores). This isn't the case in HTML5 exports, where it returns a string that uses hyphens.
This also breaks OS.get_locale_language() because it expects underscores.

Windows:

print(OS.get_locale()) # en_US
print(OS.get_locale_language()) # en

HTML5:

print(OS.get_locale()) # en-US
print(OS.get_locale_language()) # en-

It seems that adding locale = locale.replace("-", "_") here solves the issue.
If this fix is good I can open a PR.

Steps to reproduce

See above.

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Jul 15, 2022

Related to #40703.

cc @bruvzg

@bruvzg
Copy link
Member

bruvzg commented Jul 15, 2022

It seems that adding locale = locale.replace("-", "_") here solves the issue.
If this fix is good I can open a PR.

This is a good fix, we do the same for macOS / iOS and Windows.

pattlebass added a commit to pattlebass/godot that referenced this issue Jul 15, 2022
akien-mga pushed a commit that referenced this issue Jul 15, 2022
Riordan-DC pushed a commit to Riordan-DC/godot that referenced this issue Jan 24, 2023
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.

3 participants