This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git


The following commit(s) were added to refs/heads/gh-pages by this push:
     new 3f71cc1f feat(editor): configure localization for zh language
3f71cc1f is described below

commit 3f71cc1fcb3274dd27a796700e576b107f55dba1
Author: plainheart <[email protected]>
AuthorDate: Fri Sep 22 19:21:41 2023 +0800

    feat(editor): configure localization for zh language
---
 src/editor/CodeMonaco.vue | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/editor/CodeMonaco.vue b/src/editor/CodeMonaco.vue
index 3f2b6f76..5545004d 100644
--- a/src/editor/CodeMonaco.vue
+++ b/src/editor/CodeMonaco.vue
@@ -98,7 +98,16 @@ function ensureMonacoAndTsTransformer() {
       // Prebuilt TS transformer with sucrase
       store.cdnRoot + '/js/example-transform-ts-bundle.js'
     ]).then(function () {
-      window.require.config({ paths: { vs: SCRIPT_URLS.monacoDir } });
+      window.require.config({
+        paths: {
+          vs: SCRIPT_URLS.monacoDir
+        },
+        'vs/nls': {
+          availableLanguages: {
+            '*': store.locale === 'zh' ? 'zh-cn' : undefined
+          }
+        }
+      });
       return new Promise((resolve) => {
         window.require(['vs/editor/editor.main'], function () {
           loadTypes().then(() => {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to