@codingame/monaco-vscode-localization-service-override 25.1.1 → 26.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-localization-service-override",
3
- "version": "25.1.1",
3
+ "version": "26.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - localization service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "25.1.1"
18
+ "@codingame/monaco-vscode-api": "26.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -4,8 +4,7 @@ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/regist
4
4
  import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
5
5
  import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
6
6
 
7
- class WebLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchContribution {
8
- }
7
+ class WebLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchContribution {}
9
8
  const workbenchRegistry = ( Registry.as(Extensions.Workbench));
10
9
  workbenchRegistry.registerWorkbenchContribution(WebLocalizationWorkbenchContribution, LifecyclePhase.Eventually);
11
10
 
@@ -14,59 +14,77 @@ class BaseLocalizationWorkbenchContribution extends Disposable {
14
14
  registerAction2(ConfigureDisplayLanguageAction);
15
15
  registerAction2(ClearDisplayLanguageAction);
16
16
  ExtensionsRegistry.registerExtensionPoint({
17
- extensionPoint: 'localizations',
18
- defaultExtensionKind: ['ui', 'workspace'],
17
+ extensionPoint: "localizations",
18
+ defaultExtensionKind: ["ui", "workspace"],
19
19
  jsonSchema: {
20
- description: ( localize(8567, "Contributes localizations to the editor")),
21
- type: 'array',
20
+ description: ( localize(8874, "Contributes localizations to the editor")),
21
+ type: "array",
22
22
  default: [],
23
23
  items: {
24
- type: 'object',
25
- required: ['languageId', 'translations'],
26
- defaultSnippets: [{ body: { languageId: '', languageName: '', localizedLanguageName: '', translations: [{ id: 'vscode', path: '' }] } }],
24
+ type: "object",
25
+ required: ["languageId", "translations"],
26
+ defaultSnippets: [{
27
+ body: {
28
+ languageId: "",
29
+ languageName: "",
30
+ localizedLanguageName: "",
31
+ translations: [{
32
+ id: "vscode",
33
+ path: ""
34
+ }]
35
+ }
36
+ }],
27
37
  properties: {
28
38
  languageId: {
29
- description: ( localize(8568, 'Id of the language into which the display strings are translated.')),
30
- type: 'string'
39
+ description: ( localize(8875, "Id of the language into which the display strings are translated.")),
40
+ type: "string"
31
41
  },
32
42
  languageName: {
33
- description: ( localize(8569, 'Name of the language in English.')),
34
- type: 'string'
43
+ description: ( localize(8876, "Name of the language in English.")),
44
+ type: "string"
35
45
  },
36
46
  localizedLanguageName: {
37
- description: ( localize(8570, 'Name of the language in contributed language.')),
38
- type: 'string'
47
+ description: ( localize(8877, "Name of the language in contributed language.")),
48
+ type: "string"
39
49
  },
40
50
  translations: {
41
- description: ( localize(8571, 'List of translations associated to the language.')),
42
- type: 'array',
43
- default: [{ id: 'vscode', path: '' }],
51
+ description: ( localize(8878, "List of translations associated to the language.")),
52
+ type: "array",
53
+ default: [{
54
+ id: "vscode",
55
+ path: ""
56
+ }],
44
57
  items: {
45
- type: 'object',
46
- required: ['id', 'path'],
58
+ type: "object",
59
+ required: ["id", "path"],
47
60
  properties: {
48
61
  id: {
49
- type: 'string',
62
+ type: "string",
50
63
  description: ( localize(
51
- 8572,
64
+ 8879,
52
65
  "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`."
53
66
  )),
54
- pattern: '^((vscode)|([a-z0-9A-Z][a-z0-9A-Z-]*)\\.([a-z0-9A-Z][a-z0-9A-Z-]*))$',
67
+ pattern: "^((vscode)|([a-z0-9A-Z][a-z0-9A-Z-]*)\\.([a-z0-9A-Z][a-z0-9A-Z-]*))$",
55
68
  patternErrorMessage: ( localize(
56
- 8573,
69
+ 8880,
57
70
  "Id should be `vscode` or in format `publisherId.extensionName` for translating VS code or an extension respectively."
58
71
  ))
59
72
  },
60
73
  path: {
61
- type: 'string',
74
+ type: "string",
62
75
  description: ( localize(
63
- 8574,
76
+ 8881,
64
77
  "A relative path to a file containing translations for the language."
65
78
  ))
66
79
  }
67
80
  },
68
- defaultSnippets: [{ body: { id: '', path: '' } }],
69
- },
81
+ defaultSnippets: [{
82
+ body: {
83
+ id: "",
84
+ path: ""
85
+ }
86
+ }]
87
+ }
70
88
  }
71
89
  }
72
90
  }
@@ -77,7 +95,7 @@ class BaseLocalizationWorkbenchContribution extends Disposable {
77
95
  class LocalizationsDataRenderer extends Disposable {
78
96
  constructor() {
79
97
  super(...arguments);
80
- this.type = 'table';
98
+ this.type = "table";
81
99
  }
82
100
  shouldRender(manifest) {
83
101
  return !!manifest.contributes?.localizations;
@@ -85,20 +103,20 @@ class LocalizationsDataRenderer extends Disposable {
85
103
  render(manifest) {
86
104
  const localizations = manifest.contributes?.localizations || [];
87
105
  if (!localizations.length) {
88
- return { data: { headers: [], rows: [] }, dispose: () => { } };
106
+ return {
107
+ data: {
108
+ headers: [],
109
+ rows: []
110
+ },
111
+ dispose: () => {}
112
+ };
89
113
  }
90
- const headers = [
91
- ( localize(8575, "Language ID")),
92
- ( localize(8576, "Language Name")),
93
- ( localize(8577, "Language Name (Localized)")),
94
- ];
95
- const rows = ( localizations
96
- .sort((a, b) => a.languageId.localeCompare(b.languageId))
97
- .map(localization => {
114
+ const headers = [( localize(8882, "Language ID")), ( localize(8883, "Language Name")), ( localize(8884, "Language Name (Localized)"))];
115
+ const rows = ( localizations.sort((a, b) => a.languageId.localeCompare(b.languageId)).map(localization => {
98
116
  return [
99
117
  localization.languageId,
100
- localization.languageName ?? '',
101
- localization.localizedLanguageName ?? ''
118
+ localization.languageName ?? "",
119
+ localization.localizedLanguageName ?? ""
102
120
  ];
103
121
  }));
104
122
  return {
@@ -106,17 +124,17 @@ class LocalizationsDataRenderer extends Disposable {
106
124
  headers,
107
125
  rows
108
126
  },
109
- dispose: () => { }
127
+ dispose: () => {}
110
128
  };
111
129
  }
112
130
  }
113
131
  ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
114
- id: 'localizations',
115
- label: ( localize(8578, "Language Packs")),
132
+ id: "localizations",
133
+ label: ( localize(8885, "Language Packs")),
116
134
  access: {
117
135
  canToggle: false
118
136
  },
119
- renderer: ( new SyncDescriptor(LocalizationsDataRenderer)),
137
+ renderer: ( new SyncDescriptor(LocalizationsDataRenderer))
120
138
  });
121
139
 
122
140
  export { BaseLocalizationWorkbenchContribution };
@@ -8,17 +8,19 @@ import { ILocaleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench
8
8
  import { IExtensionsWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions.service';
9
9
 
10
10
  class ConfigureDisplayLanguageAction extends Action2 {
11
- static { this.ID = 'workbench.action.configureLocale'; }
11
+ static {
12
+ this.ID = "workbench.action.configureLocale";
13
+ }
12
14
  constructor() {
13
15
  super({
14
16
  id: ConfigureDisplayLanguageAction.ID,
15
- title: ( localize2(8579, "Configure Display Language")),
17
+ title: ( localize2(8886, "Configure Display Language")),
16
18
  menu: {
17
19
  id: MenuId.CommandPalette
18
20
  },
19
21
  metadata: {
20
22
  description: ( localize2(
21
- 8580,
23
+ 8887,
22
24
  "Changes the locale of VS Code based on installed language packs. Common languages include French, Chinese, Spanish, Japanese, German, Korean, and more."
23
25
  ))
24
26
  }
@@ -31,11 +33,16 @@ class ConfigureDisplayLanguageAction extends Action2 {
31
33
  const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
32
34
  const installedLanguages = await languagePackService.getInstalledLanguages();
33
35
  const disposables = ( new DisposableStore());
34
- const qp = disposables.add(quickInputService.createQuickPick({ useSeparators: true }));
36
+ const qp = disposables.add(quickInputService.createQuickPick({
37
+ useSeparators: true
38
+ }));
35
39
  qp.matchOnDescription = true;
36
- qp.placeholder = ( localize(8581, "Select Display Language"));
40
+ qp.placeholder = ( localize(8888, "Select Display Language"));
37
41
  if (installedLanguages?.length) {
38
- const items = [{ type: 'separator', label: ( localize(8582, "Installed")) }];
42
+ const items = [{
43
+ type: "separator",
44
+ label: ( localize(8889, "Installed"))
45
+ }];
39
46
  qp.items = items.concat(this.withMoreInfoButton(installedLanguages));
40
47
  }
41
48
  disposables.add(qp.onDidHide(() => {
@@ -45,11 +52,10 @@ class ConfigureDisplayLanguageAction extends Action2 {
45
52
  languagePackService.getAvailableLanguages().then(availableLanguages => {
46
53
  const newLanguages = availableLanguages.filter(l => l.id && !( installedSet.has(l.id)));
47
54
  if (newLanguages.length) {
48
- qp.items = [
49
- ...qp.items,
50
- { type: 'separator', label: ( localize(8583, "Available")) },
51
- ...this.withMoreInfoButton(newLanguages)
52
- ];
55
+ qp.items = [...qp.items, {
56
+ type: "separator",
57
+ label: ( localize(8890, "Available"))
58
+ }, ...this.withMoreInfoButton(newLanguages)];
53
59
  }
54
60
  qp.busy = false;
55
61
  });
@@ -60,7 +66,7 @@ class ConfigureDisplayLanguageAction extends Action2 {
60
66
  await localeService.setLocale(selectedLanguage);
61
67
  }
62
68
  }));
63
- disposables.add(qp.onDidTriggerItemButton(async (e) => {
69
+ disposables.add(qp.onDidTriggerItemButton(async e => {
64
70
  qp.hide();
65
71
  if (e.item.extensionId) {
66
72
  await extensionWorkbenchService.open(e.item.extensionId);
@@ -73,17 +79,21 @@ class ConfigureDisplayLanguageAction extends Action2 {
73
79
  for (const item of items) {
74
80
  if (item.extensionId) {
75
81
  item.buttons = [{
76
- tooltip: ( localize(8584, "More Info")),
77
- iconClass: 'codicon-info'
78
- }];
82
+ tooltip: ( localize(8891, "More Info")),
83
+ iconClass: "codicon-info"
84
+ }];
79
85
  }
80
86
  }
81
87
  return items;
82
88
  }
83
89
  }
84
90
  class ClearDisplayLanguageAction extends Action2 {
85
- static { this.ID = 'workbench.action.clearLocalePreference'; }
86
- static { this.LABEL = ( localize2(8585, "Clear Display Language Preference")); }
91
+ static {
92
+ this.ID = "workbench.action.clearLocalePreference";
93
+ }
94
+ static {
95
+ this.LABEL = ( localize2(8892, "Clear Display Language Preference"));
96
+ }
87
97
  constructor() {
88
98
  super({
89
99
  id: ClearDisplayLanguageAction.ID,
@@ -23,18 +23,18 @@ let AbstractLocaleService = class AbstractLocaleService {
23
23
  }
24
24
  this.storeLocale(locale, languagePackItem.extensionId);
25
25
  const restartDialog = await this.dialogService.confirm({
26
- type: 'info',
26
+ type: "info",
27
27
  message: ( localize(
28
- 14184,
28
+ 14574,
29
29
  "To change the display language, {0} needs to reload",
30
30
  this.productService.nameLong
31
31
  )),
32
32
  detail: ( localize(
33
- 14185,
33
+ 14575,
34
34
  "Press the reload button to refresh the page and set the display language to {0}.",
35
35
  languagePackItem.label
36
36
  )),
37
- primaryButton: ( localize(14186, "&&Reload")),
37
+ primaryButton: ( localize(14576, "&&Reload"))
38
38
  });
39
39
  if (restartDialog.confirmed) {
40
40
  this.hostService.restart();
@@ -46,27 +46,23 @@ let AbstractLocaleService = class AbstractLocaleService {
46
46
  return;
47
47
  }
48
48
  const restartDialog = await this.dialogService.confirm({
49
- type: 'info',
49
+ type: "info",
50
50
  message: ( localize(
51
- 14187,
51
+ 14577,
52
52
  "To change the display language, {0} needs to reload",
53
53
  this.productService.nameLong
54
54
  )),
55
55
  detail: ( localize(
56
- 14188,
56
+ 14578,
57
57
  "Press the reload button to refresh the page and use your browser's language."
58
58
  )),
59
- primaryButton: ( localize(14186, "&&Reload")),
59
+ primaryButton: ( localize(14576, "&&Reload"))
60
60
  });
61
61
  if (restartDialog.confirmed) {
62
62
  this.hostService.restart();
63
63
  }
64
64
  }
65
65
  };
66
- AbstractLocaleService = ( __decorate([
67
- ( __param(0, IDialogService)),
68
- ( __param(1, IHostService)),
69
- ( __param(2, IProductService))
70
- ], AbstractLocaleService));
66
+ AbstractLocaleService = ( __decorate([( __param(0, IDialogService)), ( __param(1, IHostService)), ( __param(2, IProductService))], AbstractLocaleService));
71
67
 
72
68
  export { AbstractLocaleService };