diff --git a/docs/params.md b/docs/params.md index 5bbcff1..ed5f2d5 100644 --- a/docs/params.md +++ b/docs/params.md @@ -14,6 +14,10 @@ Whether use light theme or dark theme. Defaults to user's last time choice or sy Whether enable Clangd and Language Client. Defaults to `true`. +### `locale` (`string`) + +Set the editor's display language. Defaults to English. Available value: `cs` `de` `es` `fr` `it` `ja` `ko` `pl` `pt-br` `qps-ploc` `ru` `tr` `zh-hans` `zh-hant`. (This list could be found in the [source of `monaco-editor-wrapper`](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper/src/vscode/localeLoader.ts)). + ### `run` (`boolean|"showOnly"`) Whether to automatically run the code when editor is ready. If `"showOnly"` is provided, the runner panel is shown but won't run the code. Defaults to `false`. diff --git a/src/preload.ts b/src/preload.ts index 93f4692..1c4f106 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -1,8 +1,9 @@ -// Use for example -// http://localhost:5173/?locale=zh-hans or -// http://localhost:5173/?locale=fr -// for a localised version +// Add this preload script because `monaco-editor-wrapper/vscode/locale` +// needs to be loaded before **ANY** import of `monaco-editor` stuff. +// Assure that `main.ts` is imported after locale loader initialized. + import { initLocalLoader } from "monaco-editor-wrapper/vscode/locale"; await initLocalLoader(); import("./main.ts"); +