Skip to content

Commit

Permalink
Complete language variants filled in for LANG var
Browse files Browse the repository at this point in the history
Part of #80072
  • Loading branch information
Tyriar committed Sep 12, 2019
1 parent e456767 commit aad4625
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,63 @@ function _getLangEnvVariable(locale?: string) {
return 'en_US.UTF-8';
}
if (n === 1) {
// app.getLocale can return just a language without a variant, fill in the variant for
// supported languages as many shells expect a 2-part locale.
// The local may only contain the language, not the variant, if this is the case guess the
// variant such that it can be used as a valid $LANG variable. The language variant chosen
// is the original and/or most prominent with help from
// https://stackoverflow.com/a/2502675/1156119
// The list of locales was generated by running `locale -a` on macOS
const languageVariants: { [key: string]: string } = {
af: 'ZA',
am: 'ET',
be: 'BY',
bg: 'BG',
ca: 'ES',
cs: 'CZ',
da: 'DK',
// de: 'AT',
// de: 'CH',
de: 'DE',
el: 'GR',
// en: 'AU',
// en: 'CA',
// en: 'GB',
// en: 'IE',
// en: 'NZ',
en: 'US',
es: 'ES',
et: 'EE',
eu: 'ES',
fi: 'FI',
// fr: 'BE',
// fr: 'CA',
// fr: 'CH',
fr: 'FR',
he: 'IL',
hr: 'HR',
hu: 'HU',
hy: 'AM',
is: 'IS',
// it: 'CH',
it: 'IT',
ja: 'JP',
kk: 'KZ',
ko: 'KR',
lt: 'LT',
// nl: 'BE',
nl: 'NL',
no: 'NO',
pl: 'PL',
pt: 'BR',
// pt: 'PT',
ro: 'RO',
ru: 'RU',
sk: 'SK',
zh: 'CN'
sl: 'SI',
sr: 'YU',
sv: 'SE',
tr: 'TR',
uk: 'UA',
zh: 'CN',
};
if (parts[0] in languageVariants) {
parts.push(languageVariants[parts[0]]);
Expand Down

0 comments on commit aad4625

Please sign in to comment.