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

Use platform.language more #171659

Merged
merged 1 commit into from
Jan 18, 2023
Merged

Use platform.language more #171659

merged 1 commit into from
Jan 18, 2023

Conversation

rzhao271
Copy link
Contributor

@rzhao271 rzhao271 commented Jan 18, 2023

Ref #169114

I added the platform.language variable in more parts of the code. That variable allows functions such as .toLocaleString() to use the application language instead of the system language. The PR also changes the terminal to use the platform.language variable, because in older versions, it was using the application language rather than the system language to create a valid locale to use.

Some examples of toLocaleString for reference:

> const n = 5;
'5'
> n.toLocaleString('en-US')
'5'
> n.toLocaleString('en-US.UTF8')
Uncaught RangeError: Incorrect locale information provided
    at Number.toLocaleString (<anonymous>)
> n.toLocaleString('en_US.UTF8')
Uncaught RangeError: Incorrect locale information provided
    at Number.toLocaleString (<anonymous>)
> n.toLocaleString('qps-ploc')
'5'
> n.toLocaleString('qps-ploc')
'5'
> n.toLocaleString('zh-hans')
'5'
> n.toLocaleString('zh-hans-cn')
'5'
> n.toLocaleString('zh-cn')
'5'

platform.language has the form zh-cn, qps-ploc, en, etc., so we should be good for the .toLocaleString() calls.

@rzhao271 rzhao271 enabled auto-merge (squash) January 18, 2023 19:07
@rzhao271 rzhao271 self-assigned this Jan 18, 2023
@vscodenpa vscodenpa added this to the January 2023 milestone Jan 18, 2023
@rzhao271 rzhao271 merged commit 7b1f598 into main Jan 18, 2023
@rzhao271 rzhao271 deleted the rzhao271/continental-haddock branch January 18, 2023 19:23
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants