Browse Source

Pull request #14939: REPORT-135106 表格字体加载问题和语言导致的图表消失问题

Merge in DESIGN/design from ~FANGLEI/design:release/11.0 to release/11.0

* commit '813ada35e87d3405b3ad84c080472c62b85f4d94':
  REPORT-135106 表格字体加载问题和语言导致的图表消失问题
release/11.0
fanglei-方磊 2 months ago
parent
commit
f76b65e103
  1. 3
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  2. 86
      designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js

3
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -128,6 +128,9 @@
if (key === "src") { if (key === "src") {
return; return;
} }
value = window.transformI18nText(value);
str += " " + key + "=\"" + value + "\""; str += " " + key + "=\"" + value + "\"";
if (key === "alt" && dataIdMap[value.trim()]) { if (key === "alt" && dataIdMap[value.trim()]) {

86
designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js

@ -21,7 +21,12 @@
"BI-Basic_Save": "保存", "BI-Basic_Save": "保存",
"BI-Basic_More": "更多", "BI-Basic_More": "更多",
"BI-Custom_Color": "自定义颜色", "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 = { var taiwan = {
@ -45,7 +50,12 @@
"BI-Basic_Save": "保存", "BI-Basic_Save": "保存",
"BI-Basic_More": "更多", "BI-Basic_More": "更多",
"BI-Custom_Color": "自定義顏色", "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 = { var english = {
@ -69,7 +79,12 @@
"BI-Basic_Save": "Save", "BI-Basic_Save": "Save",
"BI-Basic_More": "More", "BI-Basic_More": "More",
"BI-Custom_Color": "Custom Color", "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 = { var japanese = {
@ -93,7 +108,12 @@
"BI-Basic_Save": "セーブ", "BI-Basic_Save": "セーブ",
"BI-Basic_More": "もっと", "BI-Basic_More": "もっと",
"BI-Custom_Color": "カスタムカラー", "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 = { var korean = {
@ -117,7 +137,12 @@
"BI-Basic_Save": "저장", "BI-Basic_Save": "저장",
"BI-Basic_More": "더", "BI-Basic_More": "더",
"BI-Custom_Color": "맞춤 색상", "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) { 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.transformI18n = transformI18n;
window.transformI18nText = transformI18nText;
}()); }());
Loading…
Cancel
Save