提交 cddd0614 编写于 作者: R Ramya Achutha Rao

Map zh-cn,zh-tw to zh-hans,zh-hant Fixes #53275

上级 1e7d0075
......@@ -141,8 +141,9 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
return;
}
const ceintlExtensionSearch = this.galleryService.query({ names: [`MS-CEINTL.vscode-language-pack-${locale}`], pageSize: 1 });
const tagSearch = this.galleryService.query({ text: `tag:lp-${locale}`, pageSize: 1 });
const currentLocale = this.getPossibleChineseMapping(locale);
const ceintlExtensionSearch = this.galleryService.query({ names: [`MS-CEINTL.vscode-language-pack-${currentLocale}`], pageSize: 1 });
const tagSearch = this.galleryService.query({ text: `tag:lp-${currentLocale}`, pageSize: 1 });
TPromise.join([ceintlExtensionSearch, tagSearch]).then(([ceintlResult, tagResult]) => {
if (ceintlResult.total === 0 && tagResult.total === 0) {
......@@ -156,11 +157,11 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
return;
}
TPromise.join([this.galleryService.getManifest(extensionToFetchTranslationsFrom), this.galleryService.getCoreTranslation(extensionToFetchTranslationsFrom, locale)])
TPromise.join([this.galleryService.getManifest(extensionToFetchTranslationsFrom), this.galleryService.getCoreTranslation(extensionToFetchTranslationsFrom, currentLocale)])
.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 loc = manifest && manifest.contributes && manifest.contributes.localizations && manifest.contributes.localizations.filter(x => this.getPossibleChineseMapping(x.languageId) === currentLocale)[0];
const languageName = loc ? (loc.languageName || currentLocale) : currentLocale;
const languageDisplayName = loc ? (loc.localizedLanguageName || loc.languageName || currentLocale) : currentLocale;
const translationsFromPack = translation && translation.contents ? translation.contents['vs/platform/node/minimalTranslations'] : {};
const promptMessageKey = extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions';
const useEnglish = !translationsFromPack[promptMessageKey];
......@@ -191,7 +192,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => {
viewlet.search(`tag:lp-${locale}`);
viewlet.search(`tag:lp-${currentLocale}`);
viewlet.focus();
});
}
......@@ -235,6 +236,11 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
}
private getPossibleChineseMapping(locale: string): string {
locale = locale.toLowerCase();
return locale === 'zh-cn' ? 'zh-hans' : locale === 'zh-tw' ? 'zh-hant' : locale;
}
private getLanguagePackExtension(language: string): TPromise<IGalleryExtension> {
return this.localizationService.getLanguageIds(LanguageType.Core)
.then(coreLanguages => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册