From dbc3a6af84bb5095fa7419c13882a26652aeebd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Sat, 22 Mar 2025 08:59:27 +0800 Subject: [PATCH] =?UTF-8?q?Update:=20ace=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E5=A4=9A=E5=9B=BD=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mixly-modules/common/editor-ace.js | 8 +++++ common/templates/json/ace-i18n-en.json | 30 +++++++++++++++++++ common/templates/json/ace-i18n-zh-hans.json | 30 +++++++++++++++++++ common/templates/json/ace-i18n-zh-hant.json | 30 +++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 common/templates/json/ace-i18n-en.json create mode 100644 common/templates/json/ace-i18n-zh-hans.json create mode 100644 common/templates/json/ace-i18n-zh-hant.json diff --git a/common/modules/mixly-modules/common/editor-ace.js b/common/modules/mixly-modules/common/editor-ace.js index 392df21f..9a44b198 100644 --- a/common/modules/mixly-modules/common/editor-ace.js +++ b/common/modules/mixly-modules/common/editor-ace.js @@ -19,16 +19,24 @@ const { EditorBase } = Mixly; + class EditorAce extends EditorBase { static { this.CTRL_BTNS = ['resetFontSize', 'increaseFontSize', 'decreaseFontSize']; this.CTRL_BTN_TEMPLATE = '
'; 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]); } #editor_ = null; diff --git a/common/templates/json/ace-i18n-en.json b/common/templates/json/ace-i18n-en.json new file mode 100644 index 00000000..a12c1388 --- /dev/null +++ b/common/templates/json/ace-i18n-en.json @@ -0,0 +1,30 @@ +{ + "$id": "en", + "Search for": "Search for", + "All": "All", + "Replace with": "Replace with", + "Replace": "Replace", + "Toggle Replace mode": "Toggle Replace mode", + "RegExp Search": "RegExp Search", + "CaseSensitive Search": "CaseSensitive Search", + "Whole Word Search": "Whole Word Search", + "Search In Selection": "Search In Selection", + "$0 of $1": "$0 of $1", + "Looks good!": "Looks good!", + "Recently used": "Recently used", + "Other commands": "Other commands", + "No matching commands": "No matching commands", + "Autocomplete suggestions": "Autocomplete suggestions", + "Cursor at row $0": "Cursor at row $0", + "Toggle code folding, rows $0 through $1": "Toggle code folding, rows $0 through $1", + "Toggle code folding, row $0": "Toggle code folding, row $0", + "Unfold code": "Unfold code", + "Fold code": "Fold code", + "Read annotations row $0": "Read annotations row $0", + "error": "error", + "errors": "errors", + "warning": "warning", + "warnings": "warnings", + "information message": "information message", + "information messages": "information messages" +} \ No newline at end of file diff --git a/common/templates/json/ace-i18n-zh-hans.json b/common/templates/json/ace-i18n-zh-hans.json new file mode 100644 index 00000000..35adf913 --- /dev/null +++ b/common/templates/json/ace-i18n-zh-hans.json @@ -0,0 +1,30 @@ +{ + "$id": "zh-hans", + "Search for": "搜索", + "All": "全部", + "Replace with": "替换为", + "Replace": "替换", + "Toggle Replace mode": "切换替换模式", + "RegExp Search": "正则表达式搜索", + "CaseSensitive Search": "区分大小写搜索", + "Whole Word Search": "全词搜索", + "Search In Selection": "在选择中搜索", + "$0 of $1": "$0 共 $1", + "Looks good!": "看起来不错!", + "Recently used": "最近使用", + "Other commands": "其他命令", + "No matching commands": "没有匹配的命令", + "Autocomplete suggestions": "自动补全", + "Cursor at row $0": "光标位于第 $0 行", + "Toggle code folding, rows $0 through $1": "切换代码折叠,行 $0 至 $1", + "Toggle code folding, row $0": "切换代码折叠,行 $0", + "Unfold code": "展开代码", + "Fold code": "折叠代码", + "Read annotations row $0": "阅读注释行 $0", + "error": "错误", + "errors": "错误", + "warning": "警告", + "warnings": "警告", + "information message": "信息", + "information messages": "信息" +} \ No newline at end of file diff --git a/common/templates/json/ace-i18n-zh-hant.json b/common/templates/json/ace-i18n-zh-hant.json new file mode 100644 index 00000000..79d5056b --- /dev/null +++ b/common/templates/json/ace-i18n-zh-hant.json @@ -0,0 +1,30 @@ +{ + "$id": "zh-hans", + "Search for": "搜尋", + "All": "全部", + "Replace with": "替換為", + "Replace": "替換", + "Toggle Replace mode": "切換替換模式", + "RegExp Search": "正規表示式搜尋", + "CaseSensitive Search": "區分大小寫搜尋", + "Whole Word Search": "全詞搜尋", + "Search In Selection": "在選擇中搜尋", + "$0 of $1": "$0 共 $1", + "Looks good!": "看起來不錯!", + "Recently used": "最近使用", + "Other commands": "其他指令", + "No matching commands": "沒有符合的命令", + "Autocomplete suggestions": "自動補全", + "Cursor at row $0": "遊標位於第 $0 行", + "Toggle code folding, rows $0 through $1": "切換代碼折疊,行 $0 至 $1", + "Toggle code folding, row $0": "切換代碼折疊,行 $0", + "Unfold code": "展開代碼", + "Fold code": "折疊代碼", + "Read annotations row $0": "閱讀註解行 $0", + "error": "錯誤", + "errors": "錯誤", + "warning": "警告", + "warnings": "警告", + "information message": "訊息", + "information messages": "訊息" +} \ No newline at end of file