Update: ace编辑器的多国语言支持
This commit is contained in:
@@ -19,16 +19,24 @@ const {
|
||||
EditorBase
|
||||
} = Mixly;
|
||||
|
||||
|
||||
class EditorAce extends EditorBase {
|
||||
static {
|
||||
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]);
|
||||
}
|
||||
|
||||
#editor_ = null;
|
||||
|
||||
30
common/templates/json/ace-i18n-en.json
Normal file
30
common/templates/json/ace-i18n-en.json
Normal file
@@ -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"
|
||||
}
|
||||
30
common/templates/json/ace-i18n-zh-hans.json
Normal file
30
common/templates/json/ace-i18n-zh-hans.json
Normal file
@@ -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": "信息"
|
||||
}
|
||||
30
common/templates/json/ace-i18n-zh-hant.json
Normal file
30
common/templates/json/ace-i18n-zh-hant.json
Normal file
@@ -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": "訊息"
|
||||
}
|
||||
Reference in New Issue
Block a user