Update: 更新monaco (version: 0.52.2) 同时增加多国语言支持

This commit is contained in:
王立帮
2025-03-22 15:12:37 +08:00
parent dbc3a6af84
commit 26127b2747
40 changed files with 24969 additions and 115 deletions

View File

@@ -25,18 +25,17 @@ class EditorAce extends EditorBase {
this.CTRL_BTNS = ['resetFontSize', 'increaseFontSize', 'decreaseFontSize'];
this.CTRL_BTN_TEMPLATE = '<div m-id="{{d.mId}}" class="code-editor-btn setFontSize"></div>';
this.MODE_MAP = goog.getJSON(path.join(Env.templatePath, 'json/ace-mode-map.json'));
this.I18N = {
'zh-hans': goog.getJSON(path.join(Env.templatePath, 'json/ace-i18n-zh-hans.json')),
'zh-hant': goog.getJSON(path.join(Env.templatePath, 'json/ace-i18n-zh-hant.json')),
'en': goog.getJSON(path.join(Env.templatePath, 'json/ace-i18n-en.json'))
}
HTMLTemplate.add(
'html/editor/editor-code.html',
new HTMLTemplate(goog.get(path.join(Env.templatePath, 'html/editor/editor-code.html')))
);
ace.config.setMessages(this.I18N[Msg.nowLang]);
if (['zh-hans', 'zh-hant'].includes(Msg.nowLang)) {
ace.config.setMessages(
goog.getJSON(path.join(Env.templatePath, `json/ace.i18n.${Msg.nowLang}.json`))
);
}
}
#editor_ = null;