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

feat: add app.getSystemLocale() method #35697

Merged
merged 13 commits into from Sep 23, 2022

Conversation

rzhao271
Copy link
Contributor

Description of Change

This PR adds a method to fetch the OS locale from Chromium. That way, even when the application is in a certain locale, the program can still know the system locale and make recommendations based off of that.

Downstream: microsoft/vscode#159813 and PR microsoft/vscode#159958.

CC @deepak1556

Checklist

Release Notes

Notes: Added app.getSystemLocale() method.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 15, 2022
spec/chromium-spec.ts Outdated Show resolved Hide resolved
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

Love it.

API LGTM

shell/browser/browser_process_impl.h Outdated Show resolved Hide resolved
shell/browser/api/electron_api_app.h Outdated Show resolved Hide resolved
shell/browser/electron_browser_main_parts.cc Outdated Show resolved Hide resolved
ckerr
ckerr previously approved these changes Sep 15, 2022
@ckerr ckerr added enhancement ✨ api-review/requested 🗳 target/21-x-y PR should also be added to the "21-x-y" branch. labels Sep 15, 2022
@erickzhao erickzhao added the semver/minor backwards-compatible functionality label Sep 15, 2022
docs/api/app.md Outdated Show resolved Hide resolved
shell/browser/electron_browser_main_parts.cc Outdated Show resolved Hide resolved
@ckerr ckerr dismissed their stale review September 16, 2022 23:11

code updated; I will re-review

@ckerr ckerr self-requested a review September 16, 2022 23:11
@rzhao271 rzhao271 requested review from deepak1556 and removed request for ckerr September 19, 2022 15:02
Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

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

LGTM pending API review and some minor style changes.

docs/api/app.md Outdated Show resolved Hide resolved
shell/browser/browser_process_impl.h Outdated Show resolved Hide resolved
@rzhao271 rzhao271 requested review from deepak1556 and removed request for ckerr September 19, 2022 17:47
docs/api/app.md Outdated Show resolved Hide resolved
docs/api/app.md Outdated Show resolved Hide resolved
shell/browser/electron_browser_main_parts.cc Outdated Show resolved Hide resolved
@itsananderson itsananderson self-assigned this Sep 19, 2022
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

API LGTM.

Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

impl looks fine.

Deferring to @deepak1556's better wisdom on the macOS string underscores vs dashes, since I didn't know about that issue. Looks like the new test code ensures the values are hyphenated 👍

shell/browser/electron_browser_main_parts.h Outdated Show resolved Hide resolved
@itsananderson
Copy link
Contributor

API LGTM

shell/browser/electron_browser_main_parts_mac.mm Outdated Show resolved Hide resolved
filenames.auto.gni Outdated Show resolved Hide resolved
Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

API LGTM

@MarshallOfSound MarshallOfSound merged commit 8a0b4fa into electron:main Sep 23, 2022
@release-clerk
Copy link

release-clerk bot commented Sep 23, 2022

Release Notes Persisted

Added app.getSystemLocale() method.

@trop
Copy link
Contributor

trop bot commented Sep 23, 2022

I have automatically backported this PR to "21-x-y", please check out #35794

@trop trop bot added in-flight/21-x-y and removed target/21-x-y PR should also be added to the "21-x-y" branch. labels Sep 23, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Sep 23, 2022
@trop trop bot added merged/21-x-y PR was merged to the "21-x-y" branch. and removed in-flight/21-x-y labels Sep 26, 2022
@rzhao271 rzhao271 deleted the rzhao271/set-system-locale branch September 26, 2022 18:43
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
* feat: add app.getSystemLocale() method

* Update shell/browser/electron_browser_main_parts.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* Change methods to be const

* Apply PR feedback

* Fix mac compile

* Add missing scope

* Apply style changes

* Change note

* Add braces to get the comment indentation right

* Change to static

* Apply PR feedback

* Fix the documentation

* Remove extraneous file

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/requested 🗳 enhancement ✨ merged/21-x-y PR was merged to the "21-x-y" branch. semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants