未验证 提交 5d6156a0 编写于 作者: R Ramya Rao 提交者: GitHub

Show lang pack availability msg in English as well (#52706)

上级 66a1bb7f
......@@ -9,9 +9,9 @@ import { localize } from 'vs/nls';
// So that they are available for VS Code to use without downloading the entire language pack.
export const minimumTranslatedStrings = {
showLanguagePackExtensions: localize('showLanguagePackExtensions', "VS Code is available in {0}. Search for language packs in the Marketplace to get started."),
showLanguagePackExtensions: localize('showLanguagePackExtensions', "Search language packs in the Marketplace to change the display language to {0}."),
searchMarketplace: localize('searchMarketplace', "Search Marketplace"),
installAndRestartMessage: localize('installAndRestartMessage', "VS Code is available in {0}. Please install the language pack to change the display language."),
installAndRestartMessage: localize('installAndRestartMessage', "Install language pack to change the display language to {0}."),
installAndRestart: localize('installAndRestart', "Install and Restart")
};
......@@ -159,11 +159,21 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
TPromise.join([this.galleryService.getManifest(extensionToFetchTranslationsFrom), this.galleryService.getCoreTranslation(extensionToFetchTranslationsFrom, locale)])
.then(([manifest, translation]) => {
const loc = manifest && manifest.contributes && manifest.contributes.localizations && manifest.contributes.localizations.filter(x => x.languageId.toLowerCase() === locale)[0];
const languageName = loc ? (loc.languageName || locale) : locale;
const languageDisplayName = loc ? (loc.localizedLanguageName || loc.languageName || locale) : locale;
const translations = {
...minimumTranslatedStrings,
...(translation && translation.contents ? translation.contents['vs/platform/node/minimalTranslations'] : {})
};
const translationsFromPack = translation && translation.contents ? translation.contents['vs/platform/node/minimalTranslations'] : {};
const promptMessageKey = extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions';
const useEnglish = !translationsFromPack[promptMessageKey];
const translations = {};
Object.keys(minimumTranslatedStrings).forEach(key => {
if (!translationsFromPack[key] || useEnglish) {
translations[key] = minimumTranslatedStrings[key].replace('{0}', languageName);
} else {
translations[key] = `${translationsFromPack[key].replace('{0}', languageDisplayName)} (${minimumTranslatedStrings[key].replace('{0}', languageName)})`;
}
});
const logUserReaction = (userReaction: string) => {
/* __GDPR__
"languagePackSuggestion:popup" : {
......@@ -195,8 +205,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
}
};
const promptMessage = translations[extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions']
.replace('{0}', languageDisplayName);
const promptMessage = translations[promptMessageKey];
this.notificationService.prompt(
Severity.Info,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册