Skip to content

Commit

Permalink
Show lang pack availability msg in English as well (#52706)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a authored Jun 25, 2018
1 parent 66a1bb7 commit 5d6156a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/vs/platform/node/minimalTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
};

Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 5d6156a

Please sign in to comment.