Skip to content

Commit

Permalink
Fix monaco localization (eclipse-theia#13557)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Apr 12, 2024
1 parent 16982d3 commit fd5be30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
16 changes: 0 additions & 16 deletions packages/monaco/src/browser/monaco-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,6 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import * as MonacoNls from '@theia/monaco-editor-core/esm/vs/nls';
import { nls } from '@theia/core/lib/common/nls';
import { FormatType, Localization } from '@theia/core/lib/common/i18n/localization';

Object.assign(MonacoNls, {
localize(_key: string, label: string, ...args: FormatType[]): string {
if (nls.locale) {
const defaultKey = nls.getDefaultKey(label);
if (defaultKey) {
return nls.localize(defaultKey, label, ...args);
}
}
return Localization.format(label, args);
}
});

import '../../src/browser/style/index.css';
import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
import { MenuContribution, CommandContribution, quickInputServicePath } from '@theia/core/lib/common';
Expand Down
17 changes: 17 additions & 0 deletions packages/monaco/src/browser/monaco-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
* is allowed.
*/

// Before importing anything from monaco we need to override its localization function
import * as MonacoNls from '@theia/monaco-editor-core/esm/vs/nls';
import { nls } from '@theia/core/lib/common/nls';
import { FormatType, Localization } from '@theia/core/lib/common/i18n/localization';

Object.assign(MonacoNls, {
localize(_key: string, label: string, ...args: FormatType[]): string {
if (nls.locale) {
const defaultKey = nls.getDefaultKey(label);
if (defaultKey) {
return nls.localize(defaultKey, label, ...args);
}
}
return Localization.format(label, args);
}
});

import { Container } from '@theia/core/shared/inversify';
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class VSXLanguageQuickPickService extends LanguageQuickPickService {
localizationContribution.localizedLanguageName ?? localizationContribution.languageName ?? localizationContribution.languageId),
});
try {
const extensionUri = VSCodeExtensionUri.fromId(extension.extension.name, extension.extension.namespace).toString();
const extensionUri = VSCodeExtensionUri.fromId(`${extension.extension.namespace}.${extension.extension.name}`).toString();
await this.pluginServer.deploy(extensionUri);
} finally {
progress.cancel();
Expand Down

0 comments on commit fd5be30

Please sign in to comment.