feat: add app.getPreferredSystemLanguages() API (#36035)
* feat: add app.getSystemLanguage() API * Change the API to getPreferredSystemLanguages * Fix test * Clarify docs and add Linux impl * Remove USE_GLIB * Don't add C to list * Remove examples since there's a lot of edge cases * Fix lint * Add examples * Fix compile error * Apply PR feedback * Update the example
This commit is contained in:
parent
8f5959aad2
commit
5fc3ed936e
6 changed files with 76 additions and 9 deletions
|
@ -124,6 +124,19 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('app.getPreferredSystemLanguages()', () => {
|
||||
ifit(process.platform !== 'linux')('should not be empty', () => {
|
||||
expect(app.getPreferredSystemLanguages().length).to.not.equal(0);
|
||||
});
|
||||
|
||||
ifit(process.platform === 'linux')('should be empty or contain C entry', () => {
|
||||
const languages = app.getPreferredSystemLanguages();
|
||||
if (languages.length) {
|
||||
expect(languages).to.not.include('C');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('app.getLocaleCountryCode()', () => {
|
||||
it('should be empty or have length of two', () => {
|
||||
const localeCountryCode = app.getLocaleCountryCode();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue