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 ec4de690d8..54a268c63d 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 @@ -128,6 +128,9 @@ if (key === "src") { return; } + + value = window.transformI18nText(value); + str += " " + key + "=\"" + value + "\""; if (key === "alt" && dataIdMap[value.trim()]) { 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 index 205117f3cd..f80cc05e7c 100644 --- 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 @@ -21,7 +21,12 @@ "BI-Basic_Save": "保存", "BI-Basic_More": "更多", "BI-Custom_Color": "自定义颜色", - "BI-Transparent_Color": "透明" + "BI-Transparent_Color": "透明", + "Fine-Design_Chart_Category_Use_Name": "分类名", + "Fine-Design_Chart_Series_Name": "系列名", + "Fine-Design_Chart_Use_Value": "值", + "Fine-Design_Chart_Use_Percent": "百分比", + "Fine-Design_Chart_Use_Summary_Value": "汇总值" }; var taiwan = { @@ -45,7 +50,12 @@ "BI-Basic_Save": "保存", "BI-Basic_More": "更多", "BI-Custom_Color": "自定義顏色", - "BI-Transparent_Color": "透明" + "BI-Transparent_Color": "透明", + "Fine-Design_Chart_Category_Use_Name": "分類名", + "Fine-Design_Chart_Series_Name": "系列名", + "Fine-Design_Chart_Use_Value": "值", + "Fine-Design_Chart_Use_Percent": "百分比", + "Fine-Design_Chart_Use_Summary_Value": "匯總值" }; var english = { @@ -69,7 +79,12 @@ "BI-Basic_Save": "Save", "BI-Basic_More": "More", "BI-Custom_Color": "Custom Color", - "BI-Transparent_Color": "Transparent Color" + "BI-Transparent_Color": "Transparent Color", + "Fine-Design_Chart_Category_Use_Name": "Category Name", + "Fine-Design_Chart_Series_Name": "Series", + "Fine-Design_Chart_Use_Value": "Value", + "Fine-Design_Chart_Use_Percent": "Percentage", + "Fine-Design_Chart_Use_Summary_Value": "Summary Value" }; var japanese = { @@ -93,7 +108,12 @@ "BI-Basic_Save": "セーブ", "BI-Basic_More": "もっと", "BI-Custom_Color": "カスタムカラー", - "BI-Transparent_Color": "トランスペアレント" + "BI-Transparent_Color": "トランスペアレント", + "Fine-Design_Chart_Category_Use_Name": "分類名", + "Fine-Design_Chart_Series_Name": "系列名", + "Fine-Design_Chart_Use_Value": "値", + "Fine-Design_Chart_Use_Percent": "パーセンテージ", + "Fine-Design_Chart_Use_Summary_Value": "まとめ値" }; var korean = { @@ -117,7 +137,12 @@ "BI-Basic_Save": "저장", "BI-Basic_More": "더", "BI-Custom_Color": "맞춤 색상", - "BI-Transparent_Color": "투명한" + "BI-Transparent_Color": "투명한", + "Fine-Design_Chart_Category_Use_Name": "카테고리 명", + "Fine-Design_Chart_Series_Name": "표시값", + "Fine-Design_Chart_Use_Value": "값", + "Fine-Design_Chart_Use_Percent": "백분율", + "Fine-Design_Chart_Use_Summary_Value": "요약 값" }; function transformI18n(language) { @@ -144,5 +169,56 @@ } } + /** + * 将一个text转换成当前国际化语言环境的text + * @param text + * @returns {*} + */ + function transformI18nText(text) { + var i18nKey = _findI18nKey(text); + return window.BI.i18nText(i18nKey); + } + + /** + * 根据text找到i18n的key + * @param text + * @returns {string} + * @private + */ + function _findI18nKey(text) { + for (var [key, value] of Object.entries(chinese)) { + if (value === text) { + return key; + } + } + + for ([key, value] of Object.entries(taiwan)) { + if (value === text) { + return key; + } + } + + for ([key, value] of Object.entries(english)) { + if (value === text) { + return key; + } + } + + for ([key, value] of Object.entries(japanese)) { + if (value === text) { + return key; + } + } + + for ([key, value] of Object.entries(korean)) { + if (value === text) { + return key; + } + } + + return ''; + } + window.transformI18n = transformI18n; + window.transformI18nText = transformI18nText; }()); \ No newline at end of file