microsoft / microsoft/monaco-editor

Cannot change locale in monaco-typescript

Open
#2,380 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request i18n typescript
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the require.config localization settings and monaco.languages.typescript.compilerOptions.locale described in the report, then inspect the referenced vs/language/typescript/diagnosticMessages.generated.json path. Reproduce the issue in the Monaco Editor playground or a self-contained page and verify whether TypeScript diagnostic messages appear in zh-cn.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.