src/vs/workbench/contrib/localization/electron-sandbox/localization.contribution.ts/LocalizationWorkbenchContribution/checkAndInstall
class LocalizationWorkbenchContribution:	private checkAndInstall(): void {
		const language = platform.language;
		let locale = platform.locale ?? '';
		if (locale.startsWith('zh-hans')) {
			locale = 'zh-cn';
		} else if (locale.startsWith('zh-hant')) {
			locale = 'zh-tw';
		}
		const languagePackSuggestionIgnoreList = <string[]>JSON.parse(this.storageService.get(LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY, StorageScope.APPLICATION, '[]'));

		if (!this.galleryService.isEnabled()) {
			return;
		}
		if (!language || !locale || locale === 'en' || locale.indexOf('en-') === 0) {
			return;
		}
		if (locale.startsWith(language) || languagePackSuggestionIgnoreList.includes(locale)) {
			return;
		}

		this.isLocaleInstalled(locale)
			.then(async (installed) => {
				if (installed) {
					return;
				}

				let searchLocale = locale;
				let tagResult = await this.galleryService.query({ text: `tag:lp-${searchLocale}` }, CancellationToken.None);
				if (tagResult.total === 0) {
					// Trim the locale and try again.
					searchLocale = locale.split('-')[0];
					tagResult = await this.galleryService.query({ text: `tag:lp-${searchLocale}` }, CancellationToken.None);
					if (tagResult.total === 0) {
						return;
					}
				}

				const extensionToInstall = tagResult.total === 1 ? tagResult.firstPage[0] : tagResult.firstPage.find(e => e.publisher === 'MS-CEINTL' && e.name.startsWith('vscode-language-pack'));
				const extensionToFetchTranslationsFrom = extensionToInstall ?? tagResult.firstPage[0];

				if (!extensionToFetchTranslationsFrom.assets.manifest) {
					return;
				}

				Promise.all([this.galleryService.getManifest(extensionToFetchTranslationsFrom, CancellationToken.None), this.galleryService.getCoreTranslation(extensionToFetchTranslationsFrom, searchLocale)])
					.then(([manifest, translation]) => {
						const loc = manifest && manifest.contributes && manifest.contributes.localizations && manifest.contributes.localizations.find(x => locale.startsWith(x.languageId.toLowerCase()));
						const languageName = loc ? (loc.languageName || locale) : locale;
						const languageDisplayName = loc ? (loc.localizedLanguageName || loc.languageName || locale) : locale;
						const translationsFromPack: { [key: string]: string } = translation?.contents?.['vs/workbench/contrib/localization/electron-sandbox/minimalTranslations'] ?? {};
						const promptMessageKey = extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions';
						const useEnglish = !translationsFromPack[promptMessageKey];

						const translations: { [key: string]: string } = {};
						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" : {
									"owner": "TylerLeonhardt",
									"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
									"language": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
								}
							*/
							this.telemetryService.publicLog('languagePackSuggestion:popup', { userReaction, language: locale });
						};

						const searchAction = {
							label: translations['searchMarketplace'],
							run: () => {
								logUserReaction('search');
								this.paneCompositeService.openPaneComposite(EXTENSIONS_VIEWLET_ID, ViewContainerLocation.Sidebar, true)
									.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
									.then(viewlet => {
										viewlet.search(`tag:lp-${searchLocale}`);
										viewlet.focus();
									});
							}
						};

						const installAndRestartAction = {
							label: translations['installAndRestart'],
							run: () => {
								logUserReaction('installAndRestart');
								this.installExtension(extensionToInstall!).then(() => this.hostService.restart());
							}
						};

						const promptMessage = translations[promptMessageKey];

						this.notificationService.prompt(
							Severity.Info,
							promptMessage,
							[extensionToInstall ? installAndRestartAction : searchAction,
							{
								label: localize('neverAgain', "Don't Show Again"),
								isSecondary: true,
								run: () => {
									languagePackSuggestionIgnoreList.push(locale);
									this.storageService.store(
										LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY,
										JSON.stringify(languagePackSuggestionIgnoreList),
										StorageScope.APPLICATION,
										StorageTarget.USER
									);
									logUserReaction('neverShowAgain');
								}
							}],
							{
								onCancel: () => {
									logUserReaction('cancelled');
								}
							}
						);
					});
			});
	}