diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
index 1ccc146c1f..6f308ad431 100644
--- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
+++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java
@@ -1,7 +1,9 @@
package com.fr.van.chart.designer.component;
import com.fr.concurrent.NamedThreadFactory;
+import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.ModernUIPane;
+import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.type.TextAlign;
@@ -11,6 +13,7 @@ import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
+import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -63,6 +66,11 @@ public class VanChartRichEditorPane {
browser = event.getBrowser();
browser.getCacheStorage().clearCache();
+ browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/fineui.min.js"));
+ browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/design/editor/script/i18n.js"));
+ browser.executeJavaScript(generateTransformI18nJS());
+ browser.executeJavaScript(IOUtils.readResourceAsString("/com/fr/web/ui/materials.min.js"));
+
JSValue ns = browser.executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, model);
}
@@ -110,6 +118,18 @@ public class VanChartRichEditorPane {
return new RichEditorModel(content, richText.isAuto(), paramsStr.toString(), initParams, align);
}
+ public static String generateTransformI18nJS() {
+ String language = "zh_CN";
+
+ Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
+
+ if (locale != null) {
+ language = locale.toString();
+ }
+
+ return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());";
+ }
+
public static class RichEditorModel {
private String content = StringUtils.EMPTY;
private boolean auto = true;
diff --git a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
index 07fbb3ec72..e6c769f0a3 100644
--- a/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
+++ b/designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
@@ -5,26 +5,9 @@
-
-
-
+
diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
index bb5370e4fc..f3e0536797 100644
--- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
+++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
@@ -52,7 +52,7 @@
type: "bi.htape",
items: [{
type: "bi.label",
- text: "字体样式: ",
+ text: BI.i18nText("BI-Design_Font_Style") + ": ",
textAlign: "left",
width: 70
}, {
diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
index f430fea6c5..c901fd31ea 100644
--- a/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
+++ b/designer-chart/src/main/resources/com/fr/design/editor/script/editor.model.js
@@ -17,8 +17,9 @@
fontStyleItems: function () {
return [{
type: "bi.single_select_radio_item",
- text: "自动",
+ text: BI.i18nText("BI-Basic_Auto"),
hgap: 5,
+ width: 50,
logic: {
dynamic: true
},
@@ -26,8 +27,9 @@
selected: this.options.isAuto
}, {
type: "bi.single_select_radio_item",
- text: "自定义",
+ text: BI.i18nText("BI-Basic_Custom"),
hgap: 5,
+ width: 60,
logic: {
dynamic: true
},
diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/enums.js b/designer-chart/src/main/resources/com/fr/design/editor/script/enums.js
new file mode 100644
index 0000000000..461625ebc5
--- /dev/null
+++ b/designer-chart/src/main/resources/com/fr/design/editor/script/enums.js
@@ -0,0 +1,15 @@
+window.BICst = window.BICst || {};
+BICst.RICH_TEXT_INFO = {
+ DATA_ID: "data-id",
+ DATA_NAME: "data-name",
+ DATA_FULL_NAME: "data-full-name",
+ DATA_ORIGIN_ID: "data-origin-id",
+ DATA_ORIGIN_NAME: "data-origin-name",
+ DATA_ORIGIN_FULL_NAME: "data-origin-full-name",
+ DATA_IS_INSERT_PARAM: "data-is-insert-param",
+ DATA_IS_MISSING_FIELD: "data-is-missing-field",
+ DATA_UN_VALID: "data-unvalid",
+ NAME: "name",
+ ALT: "alt",
+ SRC: "src"
+};
\ No newline at end of file
diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js b/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js
new file mode 100644
index 0000000000..95b4585c94
--- /dev/null
+++ b/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js
@@ -0,0 +1,123 @@
+!(function () {
+
+ var chinese = {
+ "BI-Design_Font_Style": "字体样式",
+ "BI-Font_Size": "字号",
+ "BI-Basic_Auto": "自动",
+ "BI-Basic_Custom": "自定义",
+ "BI-Basic_Default": "默认",
+ "BI-Basic_Sim_Hei": "黑体",
+ "BI-Basic_Sim_Sun": "宋体",
+ "BI-Basic_Fang_Song": "仿宋",
+ "BI-Basic_Kai_Ti": "楷体",
+ "BI-Basic_Bold": "加粗",
+ "BI-Basic_Italic": "斜体",
+ "BI-Basic_Underline": "下划线",
+ "BI-Basic_Font_Color": "文字颜色",
+ "BI-Word_Align_Left": "文字居左",
+ "BI-Word_Align_Center": "文字居中",
+ "BI-Word_Align_Right": "文字居右"
+ };
+
+ var taiwan = {
+ "BI-Design_Font_Style": "字體樣式",
+ "BI-Font_Size": "字號",
+ "BI-Basic_Auto": "自動",
+ "BI-Basic_Custom": "自定義",
+ "BI-Basic_Default": "默認",
+ "BI-Basic_Sim_Hei": "黑體",
+ "BI-Basic_Sim_Sun": "宋體",
+ "BI-Basic_Fang_Song": "仿宋",
+ "BI-Basic_Kai_Ti": "楷體",
+ "BI-Basic_Bold": "加粗",
+ "BI-Basic_Italic": "斜體",
+ "BI-Basic_Underline": "下劃線",
+ "BI-Basic_Font_Color": "文字顏色",
+ "BI-Word_Align_Left": "文字居左",
+ "BI-Word_Align_Center": "文字居中",
+ "BI-Word_Align_Right": "文字居右"
+ };
+
+ var english = {
+ "BI-Design_Font_Style": "Font style",
+ "BI-Font_Size": "Font size",
+ "BI-Basic_Auto": "auto",
+ "BI-Basic_Custom": "custom",
+ "BI-Basic_Default": "default",
+ "BI-Basic_Sim_Hei": "Sim_Hei",
+ "BI-Basic_Sim_Sun": "Sim_Sun",
+ "BI-Basic_Fang_Song": "Fang_Song",
+ "BI-Basic_Kai_Ti": "Kai_Ti",
+ "BI-Basic_Bold": "Bold",
+ "BI-Basic_Italic": "Italic",
+ "BI-Basic_Underline": "UnderLine",
+ "BI-Basic_Font_Color": "Font Color",
+ "BI-Word_Align_Left": "Align Left",
+ "BI-Word_Align_Center": "Align Center",
+ "BI-Word_Align_Right": "Align Right"
+ };
+
+ var japanese = {
+ "BI-Design_Font_Style": "フォントスタイル",
+ "BI-Font_Size": "フォントサイズ",
+ "BI-Basic_Auto": "自動",
+ "BI-Basic_Custom": "カスタマイズ",
+ "BI-Basic_Default": "デフォルト",
+ "BI-Basic_Sim_Hei": "黒い体",
+ "BI-Basic_Sim_Sun": "ソンティ",
+ "BI-Basic_Fang_Song": "イミテーションソング",
+ "BI-Basic_Kai_Ti": "イタリック",
+ "BI-Basic_Bold": "大胆な",
+ "BI-Basic_Italic": "イタリック",
+ "BI-Basic_Underline": "アンダースコア",
+ "BI-Basic_Font_Color": "テキストの色",
+ "BI-Word_Align_Left": "左のテキスト",
+ "BI-Word_Align_Center": "テキスト中心",
+ "BI-Word_Align_Right": "右のテキスト"
+ };
+
+ var korean = {
+ "BI-Design_Font_Style": "글꼴 스타일",
+ "BI-Font_Size": "글꼴 크기",
+ "BI-Basic_Auto": "자동적 인",
+ "BI-Basic_Custom": "맞춤 설정",
+ "BI-Basic_Default": "기본",
+ "BI-Basic_Sim_Hei": "블랙 바디",
+ "BI-Basic_Sim_Sun": "송티",
+ "BI-Basic_Fang_Song": "모조 노래",
+ "BI-Basic_Kai_Ti": "기울임 꼴",
+ "BI-Basic_Bold": "굵게",
+ "BI-Basic_Italic": "이탤릭체",
+ "BI-Basic_Underline": "밑줄",
+ "BI-Basic_Font_Color": "텍스트 색상",
+ "BI-Word_Align_Left": "왼쪽 텍스트",
+ "BI-Word_Align_Center": "텍스트 중심",
+ "BI-Word_Align_Right": "오른쪽 텍스트"
+ };
+
+ function transformI18n(language) {
+ var BI = window.BI;
+
+ if (BI == null) {
+ return;
+ }
+
+ if (language == null) {
+ BI.addI18n(chinese);
+ }
+
+ if (language.indexOf('zh_TW') > -1) {
+ BI.addI18n(taiwan);
+ } else if (language.indexOf('en_US') > -1) {
+ BI.addI18n(english);
+ } else if (language.indexOf('ja_JP') > -1) {
+ BI.addI18n(japanese);
+ } else if (language.indexOf('ko_KR') > -1) {
+ BI.addI18n(korean);
+ } else {
+ BI.addI18n(chinese);
+ }
+ }
+
+ window.transformI18n = transformI18n;
+}());
\ No newline at end of file