feat: Add app.getLocaleCountryCode() method for region detection (#15035)

* Add method to get system´s user region

* Fix linter

* Remove auto types

* Improved detection for POSIX

* Change name, add specs, minor fixes

* Remove left overs

* Fix locale test

* Fix Linux test

* Coding style fixes

* Fix docs

* Add test excaption for Linux

* fix spelling

* Polishing
This commit is contained in:
Ondřej Záruba 2018-11-20 21:33:23 +01:00 committed by Shelley Vohr
parent 57d2ae1aec
commit de05ff894b
4 changed files with 58 additions and 0 deletions

View file

@ -603,6 +603,11 @@ To set the locale, you'll want to use a command line switch at app startup, whic
**Note:** On Windows you have to call it after the `ready` events gets emitted.
### `app.getLocaleCountryCode()`
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
**Note:** When unable to detect locale country code, it returns empty string.
### `app.addRecentDocument(path)` _macOS_ _Windows_
* `path` String