electron/spec/fixtures/api/locale-check/main.js

18 lines
469 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const { app } = require('electron');
const locale = process.argv[2].substr(11);
if (locale.length !== 0) {
app.commandLine.appendSwitch('lang', locale);
}
app.whenReady().then(() => {
if (process.argv[3] === '--print-env') {
process.stdout.write(String(process.env.LC_ALL));
} else {
process.stdout.write(`${app.getLocale()}|${app.getSystemLocale()}|${JSON.stringify(app.getPreferredSystemLanguages())}`);
}
2020-03-20 20:28:31 +00:00
process.stdout.end();
2020-03-20 20:28:31 +00:00
app.quit();
});