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

Improve OS::get_locale() and documentation. #40708

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jul 25, 2020

On macOS and Windows, replace - with _.
On Windows use system macros instead of bitwise AND.

Add locale format info to the documentation.

Related issue #40703
Fixes #37203

@Calinou
Copy link
Member

Calinou commented Jul 25, 2020

Does this PR supersede #37246?

@bruvzg
Copy link
Member Author

bruvzg commented Jul 25, 2020

Does this PR supersede #37246?

It should fix the same Windows issues as #37246 by using macros, and I do not think we need separate get_standardized_locale(), it's better to have as similar get_locate output as possible on all platforms. Linux / Android / UWP it's already returning _ instead of -.

… and use system macros instead of bitwise AND. Add locale format info to the documentation.
Comment on lines +206 to +209
[code]Script[/code] - optional, 4 letter [url=https://en.wikipedia.org/wiki/ISO_15924]script code[/url], in title case.
[code]COUNTRY[/code] - optional, 2 or 3 letter [url=https://en.wikipedia.org/wiki/ISO_3166-1]country code[/url], in upper case.
[code]VARIANT[/code] - optional, language variant, region and sort order. Variant can have any number of underscored key words.
[code]extra[/code] - optional, semicolon separated list of additional key words. Currency, calendar, sort order and numbering system information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing some of those are OS-specific, maybe this should be documented too? Or do all OSes follow the same format aside from some using - and others using _?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall pattern is valid for all OSes, but none of the locales have all parts. Only @ is Linux specific, the rest can be encountered on any OS.

@akien-mga akien-mga merged commit 37d0d75 into godotengine:master Dec 10, 2020
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Ah I merged without waiting for feedback on my above comment, I thought I was looking at another PR :P
But docs can be improved in a follow-up PR if relevant.

@bruvzg bruvzg deleted the improve_os_locale branch December 10, 2020 12:10
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 16, 2021
@akien-mga
Copy link
Member

Cherry-picked for 3.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS.get_locale in Windows does not match sublang
3 participants