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

zh-hans and zh-hant are invalid locales (#54696)

* zh-hans and zh-hant are invalid locales

* Allow more than 1 result in the gallery query
上级 3775e829
......@@ -141,19 +141,15 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
return;
}
const extensionIdPostfix = this.getPossibleChineseMapping(locale);
const ceintlExtensionSearch = this.galleryService.query({ names: [`MS-CEINTL.vscode-language-pack-${extensionIdPostfix}`], pageSize: 1 });
const tagSearch = this.galleryService.query({ text: `tag:lp-${locale}`, pageSize: 1 });
TPromise.join([ceintlExtensionSearch, tagSearch]).then(([ceintlResult, tagResult]) => {
if (ceintlResult.total === 0 && tagResult.total === 0) {
this.galleryService.query({ text: `tag:lp-${locale}` }).then(tagResult => {
if (tagResult.total === 0) {
return;
}
const extensionToInstall = ceintlResult.total === 1 ? ceintlResult.firstPage[0] : tagResult.total === 1 ? tagResult.firstPage[0] : null;
const extensionToFetchTranslationsFrom = extensionToInstall || (tagResult.total > 0 ? tagResult.firstPage[0] : null);
const extensionToInstall = tagResult.total === 1 ? tagResult.firstPage[0] : tagResult.firstPage.filter(e => e.publisher === 'MS-CEINTL' && e.name.indexOf('vscode-language-pack') === 0)[0];
const extensionToFetchTranslationsFrom = extensionToInstall || tagResult.firstPage[0];
if (!extensionToFetchTranslationsFrom || !extensionToFetchTranslationsFrom.assets.manifest) {
if (!extensionToFetchTranslationsFrom.assets.manifest) {
return;
}
......@@ -236,11 +232,6 @@ 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.
先完成此消息的编辑!
想要评论请 注册