Skip to content

Commit 2357842

Browse files
Moving logic to inside the _getLangEnvVariable function
1 parent 4de9253 commit 2357842

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -562,16 +562,11 @@ export class TerminalInstance implements ITerminalInstance {
562562
});
563563
}
564564
env['PTYCWD'] = cwd;
565-
if (locale) {
566-
env['LANG'] = TerminalInstance._getLangEnvVariable(locale);
567-
}
565+
env['LANG'] = TerminalInstance._getLangEnvVariable(locale);
568566
if (cols && rows) {
569567
env['PTYCOLS'] = cols.toString();
570568
env['PTYROWS'] = rows.toString();
571569
}
572-
if (!env['LANG']) {
573-
env['LANG'] = 'en_US.UTF-8'; // Avoid encoding problem with special chars. Issue #14586
574-
}
575570
return env;
576571
}
577572

@@ -618,12 +613,12 @@ export class TerminalInstance implements ITerminalInstance {
618613
return newEnv;
619614
}
620615

621-
private static _getLangEnvVariable(locale: string) {
622-
const parts = locale.split('-');
616+
private static _getLangEnvVariable(locale?: string) {
617+
const parts = locale ? locale.split('-') : [];
623618
const n = parts.length;
624619
const language = parts[0];
625620
if (n === 0) {
626-
return '';
621+
return 'en_US.UTF-8'; // Avoid encoding problem with special chars. Issue #14586
627622
}
628623
if (n === 1) {
629624
// app.getLocale can return just a language without a variant, fill in the variant for

0 commit comments

Comments
 (0)