Vite uses monaco-editor Chinese, how does vue react set monaco-editor Chinese
We can use this plugin for localization, vite-plugin-monaco-editor-nls
.
However, when I used it, I didn’t succeed in localizing it, as I found that this package is already quite old.
So, I fixed it myself and submitted a pull request to the author.
Usage
1 | pnpm add -D vite-plugin-monaco-editor-nls |
Then, install the language pack. Since the plugin’s bundled language pack is quite old, you’ll need to install the latest official language pack.
But the official language pack does not provide an npm package. So, you can only install it via a GitHub repository link.
1 | pnpm add -D git+https://github.com/microsoft/vscode-loc.git |
I have only successfully installed this package once. Later attempts all failed. I tried various proxies, but I couldn’t download it. In the end, I had no choice but to transfer it. I cloned it using GitLab (I have to say, Gitee is really tricky, it doesn’t allow cloning without public access).
1 | pnpm add -D git+https://jihulab.com/eric-gitta-moore/vscode-loc |
Then, configure your vite.config.ts
file, and you’re good to go.
1 | import reactRefresh from '@vitejs/plugin-react-refresh'; |