microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.2k stars 3.58k forks source link

Cannot change locale in monaco-typescript #2380

Open LYRbbding opened 3 years ago

LYRbbding commented 3 years ago

monaco-editor version: 0.23.0 Browser: Microsoft Edge 89.0.774.45 OS: Windows 10 (20H2) Playground code that reproduces the issue:

I want to set the locale of monaco typescript to zh-cn. However, using the code as follow, I can only see the editor showing in Chinese. The diagnostic messages of typescript are still English.

require.config({
  'vs/nls': {
    availableLanguages: {
      '*': 'zh-cn'
    }
  }
});

The value of 'monaco.languages.typescript.compileroptions.locale' in Console is 'zh-cn'. I tried to put the folder zh-cn with the file diagnositcMessages.generated.json under the path 'vs/language/typescript', but it doesn't work as well. Does it mean I did the wrong steps or this function is not available for monaco editor now.

Thanks a lot for developing this project!

HCenggel commented 2 years ago

ζ‰Ύεˆ°θ§£ε†³ζ–Ήζ³•δΊ†ε—οΌŸ

h8nor commented 1 year ago

https://github.com/microsoft/monaco-editor/blob/c5586a25cfd069349b6242a3d140223cc3d9110c/browser-amd-localized/index.html#L1-L30

eliasm307 commented 11 months ago

For anyone else having this issue, pending official support by Monaco I've made this package which adds TS/JS diagnostic message translation https://www.npmjs.com/package/monaco-editor-typescript-locales