From 9c7b547a98353b2fa8570fb6d7db14403b4055f3 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 6 Nov 2025 17:30:17 +0100 Subject: [PATCH 1/3] Dont use .js for typescript imports, as rollup adds them to the output (#5088) --- src/editor/internal/editorWithLanguages.ts | 12 ++++++------ src/editor/internal/initialize.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/editor/internal/editorWithLanguages.ts b/src/editor/internal/editorWithLanguages.ts index 8297b685..1919716f 100644 --- a/src/editor/internal/editorWithLanguages.ts +++ b/src/editor/internal/editorWithLanguages.ts @@ -1,10 +1,10 @@ -import * as css from '../../language/css/monaco.contribution.js'; -import * as html from '../../language/html/monaco.contribution.js'; -import * as json from '../../language/json/monaco.contribution.js'; -import * as typescript from '../../language/typescript/monaco.contribution.js'; -import '../../basic-languages/monaco.contribution.js'; +import * as css from '../../language/css/monaco.contribution'; +import * as html from '../../language/html/monaco.contribution'; +import * as json from '../../language/json/monaco.contribution'; +import * as typescript from '../../language/typescript/monaco.contribution'; +import '../../basic-languages/monaco.contribution'; import * as lsp from '@vscode/monaco-lsp-client'; export * from 'monaco-editor-core'; -export { createWebWorker, type IWebWorkerOptions } from '../../common/workers.js'; +export { createWebWorker, type IWebWorkerOptions } from '../../common/workers'; export { css, html, json, typescript, lsp }; diff --git a/src/editor/internal/initialize.ts b/src/editor/internal/initialize.ts index 337494bf..fa0e0bdc 100644 --- a/src/editor/internal/initialize.ts +++ b/src/editor/internal/initialize.ts @@ -1,4 +1,4 @@ -import * as monaco from 'monaco-editor-core/esm/vs/editor/editor.api.js'; +import * as monaco from 'monaco-editor-core/esm/vs/editor/editor.api'; export function getGlobalMonaco(): any { return monaco; From b3250fa2b99e93c500e71ddf5fd1caf1ba2a16e2 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 6 Nov 2025 17:30:39 +0100 Subject: [PATCH 2/3] Adds missing NLS files (#5089) --- build/esm/rollup.config.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/esm/rollup.config.mjs b/build/esm/rollup.config.mjs index 715c4e21..4c6bf1bd 100644 --- a/build/esm/rollup.config.mjs +++ b/build/esm/rollup.config.mjs @@ -15,6 +15,8 @@ import nodeResolve from '@rollup/plugin-node-resolve'; import { urlToEsmPlugin } from './rollup-url-to-module-plugin/index.mjs'; import { copyFileSync, mkdirSync } from 'fs'; import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { readdirSync } from 'fs'; const root = join(import.meta.dirname, '../../'); const outDir = join(root, './out/monaco-editor/esm'); @@ -40,6 +42,19 @@ const mappedPaths = { [join(root, 'src/')]: 'vs/', }; +function getNlsEntryPoints() { + // Scan for nls.messages.*.js files dynamically + const nlsDir = dirname(fileURLToPath(import.meta.resolve('monaco-editor-core/esm/nls.messages.en.js'))); + const nlsFiles = readdirSync(nlsDir) + .filter(file => file.startsWith('nls.messages.') && file.endsWith('.js')) + .reduce((acc, file) => { + // @ts-ignore + acc[file] = join(nlsDir, file); + return acc; + }, {}); + return nlsFiles; +} + export default defineConfig({ input: { entry: join(root, './src/editor/editor.main.ts'), @@ -47,6 +62,7 @@ export default defineConfig({ edcoreMain: join(root, './src/editor/edcore.main.ts'), editorApi: join(root, './src/editor/editor.api.ts'), editorWorker: join(root, './src/editor/editor.worker.ts'), + ...getNlsEntryPoints(), }, output: { From d89eb54d17af9e33c7385c8ed5a68103b858a59f Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 6 Nov 2025 18:08:36 +0100 Subject: [PATCH 3/3] Fixes https://github.com/microsoft/monaco-editor/issues/4997 (#5090) --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index a5403aba..e17867b5 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,15 @@ You will get: :warning: The monaco editor also ships an `AMD` build for backwards-compatibility reasons, but the `AMD` support is deprecated and will be removed in future versions. +## Localization + +To load the editor in a specific language, make sure that the corresponding nls script file is loaded before the main monaco editor script. For example, to load the editor in German, include the following script tag: +```html + +``` + +Check the sources for available languages. + ## Concepts Monaco editor is best known for being the text editor that powers VS Code. However, it's a bit more nuanced. Some basic understanding about the underlying concepts is needed to use Monaco editor effectively.