feat: add app.getSystemLocale() method (#35697)

* 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>
This commit is contained in:
Raymond Zhao 2022-09-23 11:50:46 -07:00 committed by GitHub
parent 626e248dea
commit 8a0b4fa338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 69 additions and 6 deletions

View file

@ -715,7 +715,7 @@ To set the locale, you'll want to use a command line switch at app startup, whic
**Note:** When distributing your packaged app, you have to also ship the
`locales` folder.
**Note:** On Windows, you have to call it after the `ready` events gets emitted.
**Note:** This API must be called after the `ready` event is emitted.
### `app.getLocaleCountryCode()`
@ -723,6 +723,12 @@ Returns `string` - User operating system's locale two-letter [ISO 3166](https://
**Note:** When unable to detect locale country code, it returns empty string.
### `app.getSystemLocale()`
Returns `string` - The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, the `NSLocale` object is used instead.
**Note:** This API must be called after the `ready` event is emitted.
### `app.addRecentDocument(path)` _macOS_ _Windows_
* `path` string