@codingame/monaco-vscode-localization-service-override 11.1.2 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +11 -2
- package/index.js +67 -1
- package/package.json +15 -7
- package/vscode/src/vs/workbench/contrib/localization/browser/localization.contribution.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/localization/browser/localization.contribution.js +3 -1
- package/vscode/src/vs/workbench/contrib/localization/common/localization.contribution.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/localization/common/localization.contribution.js +17 -16
- package/vscode/src/vs/workbench/contrib/localization/common/localizationsActions.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/localization/common/localizationsActions.js +12 -11
- package/vscode/src/vs/workbench/services/localization/browser/localeService.d.ts +30 -0
- package/vscode/src/vs/workbench/services/localization/browser/localeService.js +14 -12
- package/localization.js +0 -66
package/index.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import type { IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export interface AvailableLanguage {
|
|
3
|
+
locale: string;
|
|
4
|
+
languageName?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LocalizationOptions {
|
|
7
|
+
setLocale(id: string): Promise<void>;
|
|
8
|
+
clearLocale(): Promise<void>;
|
|
9
|
+
availableLanguages: AvailableLanguage[];
|
|
10
|
+
}
|
|
11
|
+
export default function getServiceOverride(options: LocalizationOptions): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
3
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
|
+
import { LanguagePackBaseService } from '@codingame/monaco-vscode-47923ab1-c4c8-58b5-89ac-fa1b998eb5dd-common/vscode/vs/platform/languagePacks/common/languagePacks';
|
|
5
|
+
import { ILanguagePackService } from 'vscode/vscode/vs/platform/languagePacks/common/languagePacks.service';
|
|
6
|
+
import { ILocaleService } from 'vscode/vscode/vs/workbench/services/localization/common/locale.service';
|
|
7
|
+
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
8
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
9
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
10
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
11
|
+
import { AbstractLocaleService } from './vscode/src/vs/workbench/services/localization/browser/localeService.js';
|
|
12
|
+
import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
|
|
13
|
+
import { setAvailableLocales, getBuiltInExtensionTranslationsUris } from 'vscode/l10n';
|
|
14
|
+
import './vscode/src/vs/workbench/contrib/localization/browser/localization.contribution.js';
|
|
15
|
+
|
|
16
|
+
let LocaleService = class LocaleService extends AbstractLocaleService {
|
|
17
|
+
constructor(options, dialogService, hostService, productService) {
|
|
18
|
+
super(dialogService, hostService, productService);
|
|
19
|
+
this.options = options;
|
|
20
|
+
}
|
|
21
|
+
async storeLocale(locale) {
|
|
22
|
+
if (locale == null) {
|
|
23
|
+
await this.options.clearLocale();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
await this.options.setLocale(locale);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async clearLocale() {
|
|
30
|
+
await this.options.clearLocale();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
LocaleService = __decorate([
|
|
34
|
+
__param(1, IDialogService),
|
|
35
|
+
__param(2, IHostService),
|
|
36
|
+
__param(3, IProductService)
|
|
37
|
+
], LocaleService);
|
|
38
|
+
let LanguagePackService = class LanguagePackService extends LanguagePackBaseService {
|
|
39
|
+
constructor(options, extensionGalleryService) {
|
|
40
|
+
super(extensionGalleryService);
|
|
41
|
+
this.options = options;
|
|
42
|
+
setAvailableLocales(new Set(options.availableLanguages.map((lang) => lang.locale)));
|
|
43
|
+
}
|
|
44
|
+
async getAvailableLanguages() {
|
|
45
|
+
return this.options.availableLanguages.map(({ locale, languageName }) => {
|
|
46
|
+
return this.createQuickPickItem(locale, languageName);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async getInstalledLanguages() {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
async getBuiltInExtensionTranslationsUri(id, language) {
|
|
53
|
+
const uri = getBuiltInExtensionTranslationsUris(language)?.[id];
|
|
54
|
+
return uri != null ? URI.parse(uri) : undefined;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
LanguagePackService = __decorate([
|
|
58
|
+
__param(1, IExtensionGalleryService)
|
|
59
|
+
], LanguagePackService);
|
|
60
|
+
function getServiceOverride(options) {
|
|
61
|
+
return {
|
|
62
|
+
[ILocaleService.toString()]: new SyncDescriptor(LocaleService, [options], true),
|
|
63
|
+
[ILanguagePackService.toString()]: new SyncDescriptor(LanguagePackService, [options], true)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-localization-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - localization service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,12 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-47923ab1-c4c8-58b5-89ac-fa1b998eb5dd-common": "12.0.1",
|
|
19
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.1"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {},
|
|
22
|
+
"peerDependenciesMeta": {},
|
|
17
23
|
"main": "index.js",
|
|
18
24
|
"module": "index.js",
|
|
19
25
|
"types": "index.d.ts",
|
|
@@ -22,10 +28,12 @@
|
|
|
22
28
|
"default": "./index.js"
|
|
23
29
|
},
|
|
24
30
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
31
|
+
"default": "./vscode/src/*.js",
|
|
32
|
+
"types": "./vscode/src/*.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./*": {
|
|
35
|
+
"default": "./*.js",
|
|
36
|
+
"types": "./*.d.ts"
|
|
26
37
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
|
|
30
38
|
}
|
|
31
39
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
|
|
1
2
|
import { BaseLocalizationWorkbenchContribution } from '../common/localization.contribution.js';
|
|
2
3
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
4
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
5
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
4
6
|
|
|
5
7
|
class WebLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchContribution {
|
|
6
8
|
}
|
|
7
9
|
const workbenchRegistry = ( Registry.as(Extensions.Workbench));
|
|
8
|
-
workbenchRegistry.registerWorkbenchContribution(WebLocalizationWorkbenchContribution,
|
|
10
|
+
workbenchRegistry.registerWorkbenchContribution(WebLocalizationWorkbenchContribution, LifecyclePhase.Eventually);
|
|
9
11
|
|
|
10
12
|
export { WebLocalizationWorkbenchContribution };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IWorkbenchContribution } from "vscode/vscode/vs/workbench/common/contributions";
|
|
3
|
+
export declare class BaseLocalizationWorkbenchContribution extends Disposable implements IWorkbenchContribution {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
@@ -16,7 +17,7 @@ class BaseLocalizationWorkbenchContribution extends Disposable {
|
|
|
16
17
|
extensionPoint: 'localizations',
|
|
17
18
|
defaultExtensionKind: ['ui', 'workspace'],
|
|
18
19
|
jsonSchema: {
|
|
19
|
-
description: ( localize(
|
|
20
|
+
description: ( localize(6996, "Contributes localizations to the editor")),
|
|
20
21
|
type: 'array',
|
|
21
22
|
default: [],
|
|
22
23
|
items: {
|
|
@@ -25,19 +26,19 @@ class BaseLocalizationWorkbenchContribution extends Disposable {
|
|
|
25
26
|
defaultSnippets: [{ body: { languageId: '', languageName: '', localizedLanguageName: '', translations: [{ id: 'vscode', path: '' }] } }],
|
|
26
27
|
properties: {
|
|
27
28
|
languageId: {
|
|
28
|
-
description: ( localize(
|
|
29
|
+
description: ( localize(6997, 'Id of the language into which the display strings are translated.')),
|
|
29
30
|
type: 'string'
|
|
30
31
|
},
|
|
31
32
|
languageName: {
|
|
32
|
-
description: ( localize(
|
|
33
|
+
description: ( localize(6998, 'Name of the language in English.')),
|
|
33
34
|
type: 'string'
|
|
34
35
|
},
|
|
35
36
|
localizedLanguageName: {
|
|
36
|
-
description: ( localize(
|
|
37
|
+
description: ( localize(6999, 'Name of the language in contributed language.')),
|
|
37
38
|
type: 'string'
|
|
38
39
|
},
|
|
39
40
|
translations: {
|
|
40
|
-
description: ( localize(
|
|
41
|
+
description: ( localize(7000, 'List of translations associated to the language.')),
|
|
41
42
|
type: 'array',
|
|
42
43
|
default: [{ id: 'vscode', path: '' }],
|
|
43
44
|
items: {
|
|
@@ -47,19 +48,19 @@ class BaseLocalizationWorkbenchContribution extends Disposable {
|
|
|
47
48
|
id: {
|
|
48
49
|
type: 'string',
|
|
49
50
|
description: ( localize(
|
|
50
|
-
|
|
51
|
+
7001,
|
|
51
52
|
"Id of VS Code or Extension for which this translation is contributed to. Id of VS Code is always `vscode` and of extension should be in format `publisherId.extensionName`."
|
|
52
53
|
)),
|
|
53
54
|
pattern: '^((vscode)|([a-z0-9A-Z][a-z0-9A-Z-]*)\\.([a-z0-9A-Z][a-z0-9A-Z-]*))$',
|
|
54
55
|
patternErrorMessage: ( localize(
|
|
55
|
-
|
|
56
|
+
7002,
|
|
56
57
|
"Id should be `vscode` or in format `publisherId.extensionName` for translating VS code or an extension respectively."
|
|
57
58
|
))
|
|
58
59
|
},
|
|
59
60
|
path: {
|
|
60
61
|
type: 'string',
|
|
61
62
|
description: ( localize(
|
|
62
|
-
|
|
63
|
+
7003,
|
|
63
64
|
"A relative path to a file containing translations for the language."
|
|
64
65
|
))
|
|
65
66
|
}
|
|
@@ -87,11 +88,11 @@ class LocalizationsDataRenderer extends Disposable {
|
|
|
87
88
|
return { data: { headers: [], rows: [] }, dispose: () => { } };
|
|
88
89
|
}
|
|
89
90
|
const headers = [
|
|
90
|
-
( localize(
|
|
91
|
-
( localize(
|
|
92
|
-
( localize(
|
|
91
|
+
( localize(7004, "Language ID")),
|
|
92
|
+
( localize(7005, "Language Name")),
|
|
93
|
+
( localize(7006, "Language Name (Localized)")),
|
|
93
94
|
];
|
|
94
|
-
const rows = (
|
|
95
|
+
const rows = ( localizations
|
|
95
96
|
.sort((a, b) => a.languageId.localeCompare(b.languageId))
|
|
96
97
|
.map(localization => {
|
|
97
98
|
return [
|
|
@@ -99,7 +100,7 @@ class LocalizationsDataRenderer extends Disposable {
|
|
|
99
100
|
localization.languageName ?? '',
|
|
100
101
|
localization.localizedLanguageName ?? ''
|
|
101
102
|
];
|
|
102
|
-
}))
|
|
103
|
+
}));
|
|
103
104
|
return {
|
|
104
105
|
data: {
|
|
105
106
|
headers,
|
|
@@ -109,13 +110,13 @@ class LocalizationsDataRenderer extends Disposable {
|
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
(
|
|
113
|
+
( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
|
|
113
114
|
id: 'localizations',
|
|
114
|
-
label: ( localize(
|
|
115
|
+
label: ( localize(7007, "Langauage Packs")),
|
|
115
116
|
access: {
|
|
116
117
|
canToggle: false
|
|
117
118
|
},
|
|
118
|
-
renderer: (
|
|
119
|
+
renderer: ( new SyncDescriptor(LocalizationsDataRenderer)),
|
|
119
120
|
});
|
|
120
121
|
|
|
121
122
|
export { BaseLocalizationWorkbenchContribution };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action2 } from "vscode/vscode/vs/platform/actions/common/actions";
|
|
2
|
+
import { ServicesAccessor } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
|
+
export declare class ConfigureDisplayLanguageAction extends Action2 {
|
|
4
|
+
static readonly ID = "workbench.action.configureLocale";
|
|
5
|
+
constructor();
|
|
6
|
+
run(accessor: ServicesAccessor): Promise<void>;
|
|
7
|
+
private withMoreInfoButton;
|
|
8
|
+
}
|
|
9
|
+
export declare class ClearDisplayLanguageAction extends Action2 {
|
|
10
|
+
static readonly ID = "workbench.action.clearLocalePreference";
|
|
11
|
+
static readonly LABEL: import("vscode/vscode/vs/nls").ILocalizedString;
|
|
12
|
+
constructor();
|
|
13
|
+
run(accessor: ServicesAccessor): Promise<void>;
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { localize2, localize } from 'vscode/vscode/vs/nls';
|
|
2
3
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
3
4
|
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
@@ -12,13 +13,13 @@ class ConfigureDisplayLanguageAction extends Action2 {
|
|
|
12
13
|
constructor() {
|
|
13
14
|
super({
|
|
14
15
|
id: ConfigureDisplayLanguageAction.ID,
|
|
15
|
-
title: ( localize2(
|
|
16
|
+
title: ( localize2(7008, "Configure Display Language")),
|
|
16
17
|
menu: {
|
|
17
18
|
id: MenuId.CommandPalette
|
|
18
19
|
},
|
|
19
20
|
metadata: {
|
|
20
21
|
description: ( localize2(
|
|
21
|
-
|
|
22
|
+
7009,
|
|
22
23
|
"Changes the locale of VS Code based on installed language packs. Common languages include French, Chinese, Spanish, Japanese, German, Korean, and more."
|
|
23
24
|
))
|
|
24
25
|
}
|
|
@@ -30,26 +31,26 @@ class ConfigureDisplayLanguageAction extends Action2 {
|
|
|
30
31
|
const localeService = accessor.get(ILocaleService);
|
|
31
32
|
const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
|
32
33
|
const installedLanguages = await languagePackService.getInstalledLanguages();
|
|
33
|
-
const disposables = (
|
|
34
|
+
const disposables = ( new DisposableStore());
|
|
34
35
|
const qp = disposables.add(quickInputService.createQuickPick({ useSeparators: true }));
|
|
35
36
|
qp.matchOnDescription = true;
|
|
36
|
-
qp.placeholder = ( localize(
|
|
37
|
+
qp.placeholder = ( localize(7010, "Select Display Language"));
|
|
37
38
|
if (installedLanguages?.length) {
|
|
38
|
-
const items = [{ type: 'separator', label: ( localize(
|
|
39
|
+
const items = [{ type: 'separator', label: ( localize(7011, "Installed")) }];
|
|
39
40
|
qp.items = items.concat(this.withMoreInfoButton(installedLanguages));
|
|
40
41
|
}
|
|
41
|
-
const source = (
|
|
42
|
+
const source = ( new CancellationTokenSource());
|
|
42
43
|
disposables.add(qp.onDispose(() => {
|
|
43
44
|
source.cancel();
|
|
44
45
|
disposables.dispose();
|
|
45
46
|
}));
|
|
46
|
-
const installedSet = (
|
|
47
|
+
const installedSet = ( new Set(installedLanguages?.map(language => language.id) ?? []));
|
|
47
48
|
languagePackService.getAvailableLanguages().then(availableLanguages => {
|
|
48
|
-
const newLanguages = availableLanguages.filter(l => l.id && !(
|
|
49
|
+
const newLanguages = availableLanguages.filter(l => l.id && !( installedSet.has(l.id)));
|
|
49
50
|
if (newLanguages.length) {
|
|
50
51
|
qp.items = [
|
|
51
52
|
...qp.items,
|
|
52
|
-
{ type: 'separator', label: ( localize(
|
|
53
|
+
{ type: 'separator', label: ( localize(7012, "Available")) },
|
|
53
54
|
...this.withMoreInfoButton(newLanguages)
|
|
54
55
|
];
|
|
55
56
|
}
|
|
@@ -75,7 +76,7 @@ class ConfigureDisplayLanguageAction extends Action2 {
|
|
|
75
76
|
for (const item of items) {
|
|
76
77
|
if (item.extensionId) {
|
|
77
78
|
item.buttons = [{
|
|
78
|
-
tooltip: ( localize(
|
|
79
|
+
tooltip: ( localize(7013, "More Info")),
|
|
79
80
|
iconClass: 'codicon-info'
|
|
80
81
|
}];
|
|
81
82
|
}
|
|
@@ -85,7 +86,7 @@ class ConfigureDisplayLanguageAction extends Action2 {
|
|
|
85
86
|
}
|
|
86
87
|
class ClearDisplayLanguageAction extends Action2 {
|
|
87
88
|
static { this.ID = 'workbench.action.clearLocalePreference'; }
|
|
88
|
-
static { this.LABEL = ( localize2(
|
|
89
|
+
static { this.LABEL = ( localize2(7014, "Clear Display Language Preference")); }
|
|
89
90
|
constructor() {
|
|
90
91
|
super({
|
|
91
92
|
id: ClearDisplayLanguageAction.ID,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
2
|
+
import { ILanguagePackItem } from "@codingame/monaco-vscode-47923ab1-c4c8-58b5-89ac-fa1b998eb5dd-common/vscode/vs/platform/languagePacks/common/languagePacks";
|
|
3
|
+
import { IActiveLanguagePackService } from "vscode/vscode/vs/workbench/services/localization/common/locale.service";
|
|
4
|
+
import { ILocaleService } from "vscode/vscode/vs/workbench/services/localization/common/locale.service";
|
|
5
|
+
import { IHostService } from "vscode/vscode/vs/workbench/services/host/browser/host.service";
|
|
6
|
+
import { IProductService } from "vscode/vscode/vs/platform/product/common/productService.service";
|
|
7
|
+
import { IExtensionGalleryService } from "vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service";
|
|
8
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
9
|
+
export declare abstract class AbstractLocaleService implements ILocaleService {
|
|
10
|
+
private readonly dialogService;
|
|
11
|
+
private readonly hostService;
|
|
12
|
+
private readonly productService;
|
|
13
|
+
readonly _serviceBrand: undefined;
|
|
14
|
+
constructor(dialogService: IDialogService, hostService: IHostService, productService: IProductService);
|
|
15
|
+
abstract storeLocale(locale: string | undefined, extensionId: string | undefined): Promise<void>;
|
|
16
|
+
abstract clearLocale(): Promise<void>;
|
|
17
|
+
setLocale(languagePackItem: ILanguagePackItem, _skipDialog?: boolean): Promise<void>;
|
|
18
|
+
clearLocalePreference(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare class WebLocaleService extends AbstractLocaleService {
|
|
21
|
+
storeLocale(locale: string | undefined, extensionId: string | undefined): Promise<void>;
|
|
22
|
+
clearLocale(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare class WebActiveLanguagePackService implements IActiveLanguagePackService {
|
|
25
|
+
private readonly galleryService;
|
|
26
|
+
private readonly logService;
|
|
27
|
+
_serviceBrand: undefined;
|
|
28
|
+
constructor(galleryService: IExtensionGalleryService, logService: ILogService);
|
|
29
|
+
getExtensionIdProvidingCurrentLocale(): Promise<string | undefined>;
|
|
30
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { Language } from 'vscode/vscode/vs/base/common/platform';
|
|
4
5
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
5
6
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
7
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
7
8
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
9
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
8
10
|
import 'vscode/vscode/vs/base/common/cancellation';
|
|
9
11
|
|
|
10
12
|
new (class LocaleStorage {
|
|
@@ -49,16 +51,16 @@ let AbstractLocaleService = class AbstractLocaleService {
|
|
|
49
51
|
const restartDialog = await this.dialogService.confirm({
|
|
50
52
|
type: 'info',
|
|
51
53
|
message: ( localize(
|
|
52
|
-
|
|
54
|
+
11657,
|
|
53
55
|
"To change the display language, {0} needs to reload",
|
|
54
56
|
this.productService.nameLong
|
|
55
57
|
)),
|
|
56
58
|
detail: ( localize(
|
|
57
|
-
|
|
59
|
+
11658,
|
|
58
60
|
"Press the reload button to refresh the page and set the display language to {0}.",
|
|
59
61
|
languagePackItem.label
|
|
60
62
|
)),
|
|
61
|
-
primaryButton: ( localize(
|
|
63
|
+
primaryButton: ( localize(11659, "&&Reload")),
|
|
62
64
|
});
|
|
63
65
|
if (restartDialog.confirmed) {
|
|
64
66
|
this.hostService.restart();
|
|
@@ -72,25 +74,25 @@ let AbstractLocaleService = class AbstractLocaleService {
|
|
|
72
74
|
const restartDialog = await this.dialogService.confirm({
|
|
73
75
|
type: 'info',
|
|
74
76
|
message: ( localize(
|
|
75
|
-
|
|
77
|
+
11660,
|
|
76
78
|
"To change the display language, {0} needs to reload",
|
|
77
79
|
this.productService.nameLong
|
|
78
80
|
)),
|
|
79
81
|
detail: ( localize(
|
|
80
|
-
|
|
82
|
+
11661,
|
|
81
83
|
"Press the reload button to refresh the page and use your browser's language."
|
|
82
84
|
)),
|
|
83
|
-
primaryButton: ( localize(
|
|
85
|
+
primaryButton: ( localize(11659, "&&Reload")),
|
|
84
86
|
});
|
|
85
87
|
if (restartDialog.confirmed) {
|
|
86
88
|
this.hostService.restart();
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
};
|
|
90
|
-
AbstractLocaleService = (
|
|
91
|
-
(
|
|
92
|
-
(
|
|
93
|
-
(
|
|
94
|
-
], AbstractLocaleService))
|
|
92
|
+
AbstractLocaleService = ( __decorate([
|
|
93
|
+
( __param(0, IDialogService)),
|
|
94
|
+
( __param(1, IHostService)),
|
|
95
|
+
( __param(2, IProductService))
|
|
96
|
+
], AbstractLocaleService));
|
|
95
97
|
|
|
96
98
|
export { AbstractLocaleService };
|
package/localization.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
-
import { LanguagePackBaseService } from 'vscode/vscode/vs/platform/languagePacks/common/languagePacks';
|
|
4
|
-
import { ILanguagePackService } from 'vscode/vscode/vs/platform/languagePacks/common/languagePacks.service';
|
|
5
|
-
import { ILocaleService } from 'vscode/vscode/vs/workbench/services/localization/common/locale.service';
|
|
6
|
-
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
7
|
-
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
8
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
9
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
10
|
-
import { AbstractLocaleService } from './vscode/src/vs/workbench/services/localization/browser/localeService.js';
|
|
11
|
-
import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
|
|
12
|
-
import { setAvailableLocales, getBuiltInExtensionTranslationsUris } from 'vscode/l10n';
|
|
13
|
-
import './vscode/src/vs/workbench/contrib/localization/browser/localization.contribution.js';
|
|
14
|
-
|
|
15
|
-
let LocaleService = class LocaleService extends AbstractLocaleService {
|
|
16
|
-
constructor(options, dialogService, hostService, productService) {
|
|
17
|
-
super(dialogService, hostService, productService);
|
|
18
|
-
this.options = options;
|
|
19
|
-
}
|
|
20
|
-
async storeLocale(locale) {
|
|
21
|
-
if (locale == null) {
|
|
22
|
-
await this.options.clearLocale();
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
await this.options.setLocale(locale);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async clearLocale() {
|
|
29
|
-
await this.options.clearLocale();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
LocaleService = __decorate([
|
|
33
|
-
( __param(1, IDialogService)),
|
|
34
|
-
( __param(2, IHostService)),
|
|
35
|
-
( __param(3, IProductService))
|
|
36
|
-
], LocaleService);
|
|
37
|
-
let LanguagePackService = class LanguagePackService extends LanguagePackBaseService {
|
|
38
|
-
constructor(options, extensionGalleryService) {
|
|
39
|
-
super(extensionGalleryService);
|
|
40
|
-
this.options = options;
|
|
41
|
-
setAvailableLocales(new Set(( options.availableLanguages.map((lang) => lang.locale))));
|
|
42
|
-
}
|
|
43
|
-
async getAvailableLanguages() {
|
|
44
|
-
return ( this.options.availableLanguages.map(({ locale, languageName }) => {
|
|
45
|
-
return this.createQuickPickItem(locale, languageName);
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
async getInstalledLanguages() {
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
async getBuiltInExtensionTranslationsUri(id, language) {
|
|
52
|
-
const uri = getBuiltInExtensionTranslationsUris(language)?.[id];
|
|
53
|
-
return uri != null ? ( URI.parse(uri)) : undefined;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
LanguagePackService = __decorate([
|
|
57
|
-
( __param(1, IExtensionGalleryService))
|
|
58
|
-
], LanguagePackService);
|
|
59
|
-
function getServiceOverride(options) {
|
|
60
|
-
return {
|
|
61
|
-
[( ILocaleService.toString())]: new SyncDescriptor(LocaleService, [options], true),
|
|
62
|
-
[( ILanguagePackService.toString())]: new SyncDescriptor(LanguagePackService, [options], true)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { getServiceOverride as default };
|