Skip to content

Commit 5d6156a

Browse files
authored
Show lang pack availability msg in English as well (#52706)
1 parent 66a1bb7 commit 5d6156a

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/vs/platform/node/minimalTranslations.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { localize } from 'vs/nls';
99
// So that they are available for VS Code to use without downloading the entire language pack.
1010

1111
export const minimumTranslatedStrings = {
12-
showLanguagePackExtensions: localize('showLanguagePackExtensions', "VS Code is available in {0}. Search for language packs in the Marketplace to get started."),
12+
showLanguagePackExtensions: localize('showLanguagePackExtensions', "Search language packs in the Marketplace to change the display language to {0}."),
1313
searchMarketplace: localize('searchMarketplace', "Search Marketplace"),
14-
installAndRestartMessage: localize('installAndRestartMessage', "VS Code is available in {0}. Please install the language pack to change the display language."),
14+
installAndRestartMessage: localize('installAndRestartMessage', "Install language pack to change the display language to {0}."),
1515
installAndRestart: localize('installAndRestart', "Install and Restart")
1616
};
1717

src/vs/workbench/parts/localizations/electron-browser/localizations.contribution.ts

+15-6
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,21 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
159159
TPromise.join([this.galleryService.getManifest(extensionToFetchTranslationsFrom), this.galleryService.getCoreTranslation(extensionToFetchTranslationsFrom, locale)])
160160
.then(([manifest, translation]) => {
161161
const loc = manifest && manifest.contributes && manifest.contributes.localizations && manifest.contributes.localizations.filter(x => x.languageId.toLowerCase() === locale)[0];
162+
const languageName = loc ? (loc.languageName || locale) : locale;
162163
const languageDisplayName = loc ? (loc.localizedLanguageName || loc.languageName || locale) : locale;
163-
const translations = {
164-
...minimumTranslatedStrings,
165-
...(translation && translation.contents ? translation.contents['vs/platform/node/minimalTranslations'] : {})
166-
};
164+
const translationsFromPack = translation && translation.contents ? translation.contents['vs/platform/node/minimalTranslations'] : {};
165+
const promptMessageKey = extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions';
166+
const useEnglish = !translationsFromPack[promptMessageKey];
167+
168+
const translations = {};
169+
Object.keys(minimumTranslatedStrings).forEach(key => {
170+
if (!translationsFromPack[key] || useEnglish) {
171+
translations[key] = minimumTranslatedStrings[key].replace('{0}', languageName);
172+
} else {
173+
translations[key] = `${translationsFromPack[key].replace('{0}', languageDisplayName)} (${minimumTranslatedStrings[key].replace('{0}', languageName)})`;
174+
}
175+
});
176+
167177
const logUserReaction = (userReaction: string) => {
168178
/* __GDPR__
169179
"languagePackSuggestion:popup" : {
@@ -195,8 +205,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
195205
}
196206
};
197207

198-
const promptMessage = translations[extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions']
199-
.replace('{0}', languageDisplayName);
208+
const promptMessage = translations[promptMessageKey];
200209

201210
this.notificationService.prompt(
202211
Severity.Info,

0 commit comments

Comments
 (0)