Skip to content

Commit 74de3be

Browse files
committed
Read locale information from environment
1 parent 5f33168 commit 74de3be

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/vs/workbench/electron-browser/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,17 @@
164164
// In the bundled version the nls plugin is packaged with the loader so the NLS Plugins
165165
// loads as soon as the loader loads. To be able to have pseudo translation
166166
createScript(rootUrl + '/vs/loader.js', function() {
167-
var nlsConfig = getNlsPluginConfiguration(configuration);
167+
var nlsConfig;
168+
try {
169+
var config = process.env['VSCODE_NLS_CONFIG'];
170+
if (config) {
171+
nlsConfig = JSON.parse(config);
172+
}
173+
} catch (e) {
174+
}
175+
if (!nlsConfig) {
176+
nlsConfig = getNlsPluginConfiguration(configuration);
177+
}
168178
require.config({
169179
baseUrl: rootUrl,
170180
'vs/nls': nlsConfig,

src/vs/workbench/electron-browser/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ export function startup(environment: IMainEnvironment, globalSettings: IGlobalSe
5050
};
5151

5252
// Inherit navigator language
53-
environment.language = navigator.language;
53+
let language = navigator.language;
54+
try {
55+
var config = process.env['VSCODE_NLS_CONFIG'];
56+
if (config) {
57+
language = JSON.parse(config).locale;
58+
}
59+
} catch (e) {
60+
}
61+
environment.language = language;
5462

5563
// Shell Options
5664
let filesToOpen = environment.filesToOpen && environment.filesToOpen.length ? toInputs(environment.filesToOpen) : null;

0 commit comments

Comments
 (0)