electron: SetLocale through app.commandLine.appendSwitch not working
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
- 5.0.0
- Operating System:
- Windows 10 (1709)
- Last Known Working Electron version:
- 4.1.5
Expected Behavior
I expected calling app.commandLine.appendSwitch('lang', 'el') and then later at app ready event that calling app.getLocale() would return “el”
Actual Behavior
Calling app.getLocale() returns “en-US” that is the system locale currently set on local machine.
To Reproduce
Run this code in main process:
var electron = require('electron');
var app = electron.app;
app.commandLine.appendSwitch('lang', 'el');
app.on('ready', function () {
console.log(app.getLocale());
});
Additional Information
Problem exists even if there is a browserWindow created before the console.log Chromium window also uses the wrong locale.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 18 (3 by maintainers)
This issue still exists in electron v8.2.0
Tried to set language in the main JS file like this:
app.commandLine.appendSwitch("lang", "es");But
app.getLocale()still returned the system languageStill not working on 11.2.0
This is not working in
8.3.0can this be reopened?Any update on this? If it’s not feasible to set locale maybe remove it from documentation?
This is not working in 9.1.1 as well, please reopen it and give some help