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:
parent
626e248dea
commit
8a0b4fa338
11 changed files with 69 additions and 6 deletions
|
@ -374,6 +374,7 @@ describe('command line switches', () => {
|
|||
});
|
||||
describe('--lang switch', () => {
|
||||
const currentLocale = app.getLocale();
|
||||
const currentSystemLocale = app.getSystemLocale();
|
||||
const testLocale = async (locale: string, result: string, printEnv: boolean = false) => {
|
||||
const appPath = path.join(fixturesPath, 'api', 'locale-check');
|
||||
const args = [appPath, `--set-lang=${locale}`];
|
||||
|
@ -396,8 +397,9 @@ describe('command line switches', () => {
|
|||
expect(output).to.equal(result);
|
||||
};
|
||||
|
||||
it('should set the locale', async () => testLocale('fr', 'fr'));
|
||||
it('should not set an invalid locale', async () => testLocale('asdfkl', currentLocale));
|
||||
it('should set the locale', async () => testLocale('fr', `fr|${currentSystemLocale}`));
|
||||
it('should set the locale with country code', async () => testLocale('zh-CN', `zh-CN|${currentSystemLocale}`));
|
||||
it('should not set an invalid locale', async () => testLocale('asdfkl', `${currentLocale}|${currentSystemLocale}`));
|
||||
|
||||
const lcAll = String(process.env.LC_ALL);
|
||||
ifit(process.platform === 'linux')('current process has a valid LC_ALL env', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue