mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -19,17 +19,12 @@ export interface ITranslation {
|
||||
path: string;
|
||||
}
|
||||
|
||||
export const enum LanguageType {
|
||||
Core = 1,
|
||||
Contributed
|
||||
}
|
||||
|
||||
export const ILocalizationsService = createDecorator<ILocalizationsService>('localizationsService');
|
||||
export interface ILocalizationsService {
|
||||
_serviceBrand: undefined;
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
readonly onDidLanguagesChange: Event<void>;
|
||||
getLanguageIds(type?: LanguageType): Promise<string[]>;
|
||||
getLanguageIds(): Promise<string[]>;
|
||||
}
|
||||
|
||||
export function isValidLocalization(localization: ILocalization): boolean {
|
||||
@@ -54,4 +49,4 @@ export function isValidLocalization(localization: ILocalization): boolean {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ import { INativeEnvironmentService } from 'vs/platform/environment/node/environm
|
||||
import { Queue } from 'vs/base/common/async';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isValidLocalization, ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { isValidLocalization, ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
import { distinct, equals } from 'vs/base/common/arrays';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
@@ -28,14 +27,9 @@ interface ILanguagePack {
|
||||
translations: { [id: string]: string };
|
||||
}
|
||||
|
||||
const systemLanguages: string[] = ['de', 'en', 'en-US', 'es', 'fr', 'it', 'ja', 'ko', 'ru', 'zh-CN', 'zh-TW'];
|
||||
if (product.quality !== 'stable') {
|
||||
systemLanguages.push('hu');
|
||||
}
|
||||
|
||||
export class LocalizationsService extends Disposable implements ILocalizationsService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly cache: LanguagePacksCache;
|
||||
|
||||
@@ -54,13 +48,11 @@ export class LocalizationsService extends Disposable implements ILocalizationsSe
|
||||
this._register(extensionManagementService.onDidUninstallExtension(({ identifier }) => this.onDidUninstallExtension(identifier)));
|
||||
}
|
||||
|
||||
getLanguageIds(type: LanguageType): Promise<string[]> {
|
||||
if (type === LanguageType.Core) {
|
||||
return Promise.resolve([...systemLanguages]);
|
||||
}
|
||||
getLanguageIds(): Promise<string[]> {
|
||||
return this.cache.getLanguagePacks()
|
||||
.then(languagePacks => {
|
||||
const languages = type === LanguageType.Contributed ? Object.keys(languagePacks) : [...systemLanguages, ...Object.keys(languagePacks)];
|
||||
// Contributed languages are those installed via extension packs, so does not include English
|
||||
const languages = ['en', ...Object.keys(languagePacks)];
|
||||
return distinct(languages);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user