diff --git a/index.html b/index.html index 59050ea24..c158cea13 100644 --- a/index.html +++ b/index.html @@ -23,7 +23,8 @@

Python language client and language server

Please execute npm run start:example:server:python beforehand:
Client for Python Pyright Language Server

Langium client and language server

- Client & Statemachine LS (Web Worker) + Client & Statemachine LS (Web Worker)
+ Localizations: German French and Spanish

Other examples

Browser Example

diff --git a/package-lock.json b/package-lock.json index 1090634f3..765d688b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -114,6 +114,30 @@ "vscode": "npm:@codingame/monaco-vscode-api@1.83.3-next.0" } }, + "node_modules/@codingame/monaco-vscode-language-pack-de": { + "version": "1.83.3-next.0", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-language-pack-de/-/monaco-vscode-language-pack-de-1.83.3-next.0.tgz", + "integrity": "sha512-qrED0DK6KBoDj9hQnU7IaYBPaeF14AvnGagLnIuow25X3BoS/skI20waVCDLJrqOtsw1tBzLvDVlCCaTpV7Fxg==", + "dependencies": { + "vscode": "npm:@codingame/monaco-vscode-api@1.83.3-next.0" + } + }, + "node_modules/@codingame/monaco-vscode-language-pack-es": { + "version": "1.83.3-next.0", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-language-pack-es/-/monaco-vscode-language-pack-es-1.83.3-next.0.tgz", + "integrity": "sha512-Z0ITp7OroRPIvbwHX7R3NAUp7Y2Q+s+qCiXrK/RhS5d1Hkh9o1gm68bdGcsBRnxdGO/FbHjHjvUTTWR3v6xvnw==", + "dependencies": { + "vscode": "npm:@codingame/monaco-vscode-api@1.83.3-next.0" + } + }, + "node_modules/@codingame/monaco-vscode-language-pack-fr": { + "version": "1.83.3-next.0", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-language-pack-fr/-/monaco-vscode-language-pack-fr-1.83.3-next.0.tgz", + "integrity": "sha512-LRWR/Co2aKz+UDN4aW+WSCEqJghyyKHMBngiCEq941jHl4lxdRRNNJBIn9K04wekrx0O3i7faU00Tqkc+CJB2A==", + "dependencies": { + "vscode": "npm:@codingame/monaco-vscode-api@1.83.3-next.0" + } + }, "node_modules/@codingame/monaco-vscode-languages-service-override": { "version": "1.83.3-next.0", "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-languages-service-override/-/monaco-vscode-languages-service-override-1.83.3-next.0.tgz", @@ -6487,6 +6511,9 @@ "@codingame/monaco-vscode-files-service-override": "~1.83.3-next.0", "@codingame/monaco-vscode-json-default-extension": "~1.83.3-next.0", "@codingame/monaco-vscode-keybindings-service-override": "~1.83.3-next.0", + "@codingame/monaco-vscode-language-pack-de": "~1.83.3-next.0", + "@codingame/monaco-vscode-language-pack-es": "~1.83.3-next.0", + "@codingame/monaco-vscode-language-pack-fr": "~1.83.3-next.0", "@codingame/monaco-vscode-python-default-extension": "~1.83.3-next.0", "@codingame/monaco-vscode-textmate-service-override": "~1.83.3-next.0", "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.83.3-next.0", diff --git a/packages/examples/package.json b/packages/examples/package.json index 8d184593a..e91f13347 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -52,6 +52,9 @@ "@codingame/monaco-vscode-textmate-service-override": "~1.83.3-next.0", "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.83.3-next.0", "@codingame/monaco-vscode-theme-service-override": "~1.83.3-next.0", + "@codingame/monaco-vscode-language-pack-de": "~1.83.3-next.0", + "@codingame/monaco-vscode-language-pack-es": "~1.83.3-next.0", + "@codingame/monaco-vscode-language-pack-fr": "~1.83.3-next.0", "express": "~4.18.2", "langium": "~2.0.2", "langium-statemachine-dsl": "~2.0.0", diff --git a/packages/examples/src/langium/localeLoader.ts b/packages/examples/src/langium/localeLoader.ts new file mode 100644 index 000000000..597777dbf --- /dev/null +++ b/packages/examples/src/langium/localeLoader.ts @@ -0,0 +1,28 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ + +export const loadLocales = async () => { + const locale = new URLSearchParams(window.location.search).get('locale'); + const localeLoader: Partial Promise>> = { + de: async () => { + await import('@codingame/monaco-vscode-language-pack-de'); + }, + es: async () => { + await import('@codingame/monaco-vscode-language-pack-es'); + }, + fr: async () => { + await import('@codingame/monaco-vscode-language-pack-fr'); + } + }; + + if (locale != null) { + const loader = localeLoader[locale]; + if (loader != null) { + await loader(); + } else { + console.error(`Unknown locale ${locale}`); + } + } +}; diff --git a/packages/examples/statemachine_client.html b/packages/examples/statemachine_client.html index 6a2c89c80..8975ddba9 100644 --- a/packages/examples/statemachine_client.html +++ b/packages/examples/statemachine_client.html @@ -11,8 +11,10 @@

Client & Statemachine DSL Web Worker Language Server Example