From 55d4cf29868787a94377ea2e659da9e74e062628 Mon Sep 17 00:00:00 2001 From: liuyang Date: Wed, 29 Jul 2020 20:28:45 +0800 Subject: [PATCH] feat(globalization fix): pivot table , drop cell --- src/controllers/constant.js | 20 ++++- src/controllers/dropCell.js | 35 +++++--- src/controllers/filter.js | 2 +- src/controllers/pivotTable.js | 162 ++++++++++++++++++++-------------- src/locale/en.js | 69 ++++++++++++++- src/locale/zh.js | 67 +++++++++++++- 6 files changed, 271 insertions(+), 84 deletions(-) diff --git a/src/controllers/constant.js b/src/controllers/constant.js index a2cd635db..39b999549 100644 --- a/src/controllers/constant.js +++ b/src/controllers/constant.js @@ -434,9 +434,21 @@ function rightclickHTML(){ `; } -const pivottableconfigHTML = '
排序
排序依据
显示总计
', - pivottablesumHTML = '
求和
数值计数
计数
去重计数
平均值
最大值
最小值
中位数
乘积
标准差
整体标准差
方差
整体方差
', - sheetHTML = '
${name} ${colorset}
', +const pivottableconfigHTML = function(){ + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; + + return '
'+locale_pivotTable.titleSort+'
'+locale_pivotTable.titleSortBy+'
'+locale_pivotTable.titleShowSum+'
'; +} + +const pivottablesumHTML = function(){ + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; + + return '
'+locale_pivotTable.valueStatisticsSUM+'
'+locale_pivotTable.valueStatisticsCOUNT+'
'+locale_pivotTable.valueStatisticsCOUNTA+'
'+locale_pivotTable.valueStatisticsCOUNTUNIQUE+'
'+locale_pivotTable.valueStatisticsAVERAGE+'
'+locale_pivotTable.valueStatisticsMAX+'
'+locale_pivotTable.valueStatisticsMIN+'
'+locale_pivotTable.valueStatisticsMEDIAN+'
'+locale_pivotTable.valueStatisticsPRODUCT+'
'+locale_pivotTable.valueStatisticsSTDEV+'
'+locale_pivotTable.valueStatisticsSTDEVP+'
'+locale_pivotTable.valueStatisticslet+'
'+locale_pivotTable.valueStatisticsVARP+'
'; +} + + const sheetHTML = '
${name} ${colorset}
', columnHeaderHTML = '
${column}
', sheetselectlistHTML = '
${item}
', sheetselectlistitemHTML = '
${icon}${name}
', @@ -494,7 +506,7 @@ function sheetconfigHTML(){ const luckysheetPivotTableHTML = function(){ const _locale = locale(); const locale_pivotTable = _locale.pivotTable; - return '
数据透视表
编辑范围
选择需要添加到数据透视表的字段 清除
筛选
数值
'; + return '
'+locale_pivotTable.title+'
'+locale_pivotTable.editRange+'
'+locale_pivotTable.tipPivotFieldSelected+' '+locale_pivotTable.btnClearSelectedField+'
'+locale_pivotTable.btnFilter+'
'+locale_pivotTable.titleRow+'
'+locale_pivotTable.titleColumn+'
'+locale_pivotTable.titleValue+'
'; } function filtermenuHTML() { diff --git a/src/controllers/dropCell.js b/src/controllers/dropCell.js index 5f669529d..be0e93d21 100644 --- a/src/controllers/dropCell.js +++ b/src/controllers/dropCell.js @@ -9,8 +9,9 @@ import formula from '../global/formula'; import conditionformat from './conditionformat'; import { selectHightlightShow } from './select'; import { getSheetIndex } from '../methods/get'; -import { getObjType } from '../utils/util'; +import { getObjType, replaceHtml } from '../utils/util'; import Store from '../store'; +import locale from '../locale/locale'; //选区下拉 const luckysheetDropCell = { @@ -20,47 +21,47 @@ const luckysheetDropCell = { typeListHtml: '
'+ '
'+ '
'+ - '复制单元格'+ + '${copyCell}'+ '
'+ '
'+ '
'+ '
'+ - '填充序列'+ + '${sequence}'+ '
'+ '
'+ '
'+ '
'+ - '仅填充格式'+ + '${onlyFormat}'+ '
'+ '
'+ '
'+ '
'+ - '不带格式填充'+ + '${noFormat}'+ '
'+ '
'+ '
'+ '
'+ - '以天数填充'+ + '${day}'+ '
'+ '
'+ '
'+ '
'+ - '以工作日填充'+ + '${workDay}'+ '
'+ '
'+ '
'+ '
'+ - '以月填充'+ + '${month}'+ '
'+ '
'+ '
'+ '
'+ - '以年填充'+ + '${year}'+ '
'+ '
'+ '
'+ '
'+ - '以中文小写数字填充'+ + '${chineseNumber}'+ '
'+ '
'+ '
', @@ -310,7 +311,19 @@ const luckysheetDropCell = { $(this).css("background-color", "#f1f1f1"); }).mousedown(function(event){ $("#luckysheet-dropCell-typeList").remove(); - $("body").append(_this.typeListHtml); + const _locale = locale(); + const locale_dropCell = _locale.dropCell; + $("body").append(replaceHtml(_this.typeListHtml,{ + copyCell:locale_dropCell.copyCell, + sequence:locale_dropCell.sequence, + onlyFormat:locale_dropCell.onlyFormat, + noFormat:locale_dropCell.noFormat, + day:locale_dropCell.day, + workDay:locale_dropCell.workDay, + month:locale_dropCell.month, + year:locale_dropCell.year, + chineseNumber:locale_dropCell.chineseNumber, + })); let typeItemHide = _this.typeItemHide(); if(!typeItemHide[0] && !typeItemHide[1] && !typeItemHide[2] && !typeItemHide[3] && !typeItemHide[4] && !typeItemHide[5] && !typeItemHide[6]){ diff --git a/src/controllers/filter.js b/src/controllers/filter.js index cd6cca5b9..d4ce2cb20 100644 --- a/src/controllers/filter.js +++ b/src/controllers/filter.js @@ -685,7 +685,7 @@ function initialFilterHandler(){ for(let x in vmap[v]){ let text; if((v + "#$$$#" + x) == "null#$$$#null"){ - text = "(空白)"; + text = locale_filter.valueBlank; } else{ text = x; diff --git a/src/controllers/pivotTable.js b/src/controllers/pivotTable.js index aea4af5f9..11859ae6f 100644 --- a/src/controllers/pivotTable.js +++ b/src/controllers/pivotTable.js @@ -33,6 +33,7 @@ import sheetmanage from './sheetmanage'; import luckysheetsizeauto from './resize'; import server from './server'; import Store from '../store'; +import locale from '../locale/locale'; const pivotTable = { pivotDatas: null, @@ -238,6 +239,9 @@ const pivotTable = { luckysheetsliderlistitemfilter: function ($filter) { let _this = this; + const _locale = locale(); + const locale_filter = _locale.filter; + let $t = $filter.parent(), toffset = $t.offset(), $menu = $("#luckysheet-pivotTableFilter-menu"), @@ -263,7 +267,7 @@ const pivotTable = { $menu.data("index", cindex); $("#luckysheet-pivotTableFilter-menu .luckysheet-pivotTableFilter-selected-input").hide().find("input").val(); - $("#luckysheet-pivotTableFilter-selected span").data("type", "0").data("type", null).text("无"); + $("#luckysheet-pivotTableFilter-selected span").data("type", "0").data("type", null).text(locale_filter.filiterInputNone); let byconditiontype = $t.data("byconditiontype"); $("#luckysheet-pivotTableFilter-selected span").data("value", $t.data("byconditionvalue")).data("type", byconditiontype).text($t.data("byconditiontext")); @@ -277,7 +281,7 @@ const pivotTable = { $("#luckysheet-pivotTableFilter-menu .luckysheet-pivotTableFilter-selected-input").eq(0).show().find("input").val($t.data("byconditionvalue1")); } - $("#luckysheet-pivotTableFilter-byvalue-select").empty().html('
数据量大!请稍后
'); + $("#luckysheet-pivotTableFilter-byvalue-select").empty().html('
'+locale_filter.filiterMoreDataTip+'
'); let rowhiddenother = {}; //其它筛选列的隐藏行 $("#luckysheet-modal-dialog-pivotTable-list .luckysheet-modal-dialog-slider-list-item").not($t.get(0)).each(function () { @@ -440,7 +444,7 @@ const pivotTable = { '
' + '' + '' + - '' + + '' + '( ' + msum + ' )' + '
' + '
' + dayHtml + '
' + @@ -451,7 +455,7 @@ const pivotTable = { '
' + '' + '' + - '' + + '' + '( ' + msum + ' )' + '
' + '
' + dayHtml + '
' + @@ -466,7 +470,7 @@ const pivotTable = { '
' + '' + '' + - '' + + '' + '( ' + ysum + ' )' + '
' + '
' + monthHtml + '
' + @@ -477,7 +481,7 @@ const pivotTable = { '
' + '' + '' + - '' + + '' + '( ' + ysum + ' )' + '
' + '
' + monthHtml + '
' + @@ -498,7 +502,7 @@ const pivotTable = { for(let x in vmap[v]){ let text; if((v + "#$$$#" + x) == "null#$$$#null"){ - text = "(空白)"; + text = locale_filter.valueBlank; } else{ text = x; @@ -534,44 +538,47 @@ const pivotTable = { getSumTypeName: function (type) { let name = ""; + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; + if (type == "SUM") { - name = "求和"; + name = locale_pivotTable.valueStatisticsSUM; } else if (type == "COUNT") { - name = "数值计数"; + name = locale_pivotTable.valueStatisticsCOUNT; } else if (type == "COUNTA") { - name = "计数"; + name = locale_pivotTable.valueStatisticsCOUNTA; } else if (type == "COUNTUNIQUE") { - name = "去重计数"; + name = locale_pivotTable.valueStatisticsCOUNTUNIQUE; } else if (type == "AVERAGE") { - name = "平均值"; + name = locale_pivotTable.valueStatisticsAVERAGE; } else if (type == "MAX") { - name = "最大值"; + name = locale_pivotTable.valueStatisticsMAX; } else if (type == "MIN") { - name = "最小值"; + name = locale_pivotTable.valueStatisticsMIN; } else if (type == "MEDIAN") { - name = "中位数"; + name = locale_pivotTable.valueStatisticsMEDIAN; } else if (type == "PRODUCT") { - name = "乘积"; + name = locale_pivotTable.valueStatisticsPRODUCT; } else if (type == "STDEV") { - name = "标准差"; + name = locale_pivotTable.valueStatisticsSTDEV; } else if (type == "STDEVP") { - name = "整体标准差"; + name = locale_pivotTable.valueStatisticsSTDEVP; } else if (type == "let") { - name = "方差"; + name = locale_pivotTable.valueStatisticslet; } else if (type == "VARP") { - name = "整体方差"; + name = locale_pivotTable.valueStatisticsVARP; } return name; @@ -614,18 +621,21 @@ const pivotTable = { let datasheetindex = Store.currentSheetIndex; + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; + if(isEditMode()){ - alert("非编辑模式下禁止该操作!"); + alert(locale_pivotTable.errorNotAllowEdit); return; } if(Store.luckysheet_select_save.length > 1){ - tooltip.info("提示", "不能对多重选择区域执行此操作,请选择单个区域,然后再试"); + tooltip.info("", locale_pivotTable.errorNotAllowMulti); return } if (Store.luckysheet_select_save.length == 0 || Store.luckysheet_select_save[0].row[0] == Store.luckysheet_select_save[0].row[1] || Store.luckysheet_select_save[0].column[0] == Store.luckysheet_select_save[0].column[1]) { - tooltip.info("提示", "请选择新建透视表的区域"); + tooltip.info("", locale_pivotTable.errorSelectRange); return; } @@ -642,11 +652,14 @@ const pivotTable = { changePivotTable: function (index) { let _this = this; + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; + let pivotDataSheetIndex = Store.luckysheetfile[getSheetIndex(index)].pivotTable.pivotDataSheetIndex; let real_pivotDataSheetIndex = getSheetIndex(pivotDataSheetIndex); if(real_pivotDataSheetIndex == null){ - tooltip.info("此数据透视表的源数据已损坏!", ""); + tooltip.info(locale_pivotTable.errorIsDamage, ""); return; } @@ -869,22 +882,28 @@ const pivotTable = { }, initialPivotManage: function (restore) { let _this = this; + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; + const locale_button = _locale.button; + const locale_filter = _locale.filter; if (_this.initial) { _this.initial = false; + + $("body").append(luckysheetPivotTableHTML()); $("#luckysheet-modal-dialog-slider-close").click(function () { $("#luckysheet-modal-dialog-slider-pivot").hide(); luckysheetsizeauto(); }); - $("body").append(replaceHtml(modelHTML, { "id": "luckysheet-data-pivotTable-selection", "addclass": "luckysheet-data-pivotTable-selection", "title": "选取数据范围", "content": '', "botton": '' })); + $("body").append(replaceHtml(modelHTML, { "id": "luckysheet-data-pivotTable-selection", "addclass": "luckysheet-data-pivotTable-selection", "title": locale_pivotTable.titleSelectionDataRange, "content": '', "botton": '' })); $("body").append(replaceHtml(filtermenuHTML(), { "menuid": "pivotTableFilter" })); $("body").append(replaceHtml(filtersubmenuHTML(), { "menuid": "pivotTableFilter" })); - $("body").append(pivottableconfigHTML); - $("body").append(pivottablesumHTML); + $("body").append(pivottableconfigHTML()); + $("body").append(pivottablesumHTML()); $("#luckysheet-pivotTableFilter-orderby-asc").remove(); $("#luckysheet-pivotTableFilter-orderby-desc").next().remove(); @@ -1138,7 +1157,7 @@ const pivotTable = { $t.next().slideToggle(200); setTimeout(function () { if ($t.attr("id") == "luckysheet-pivotTableFilter-bycondition" && $("#luckysheet-pivotTableFilter-bycondition").next().is(":visible")) { - if ($("#luckysheet-pivotTableFilter-selected span").text() != "无") { + if ($("#luckysheet-pivotTableFilter-selected span").text() != locale_filter.filiterInputNone) { $("#luckysheet-pivotTableFilter-byvalue").next().slideUp(200); } } @@ -1242,7 +1261,7 @@ const pivotTable = { $("#luckysheet-modal-dialog-pivotTable-list .luckysheet-modal-dialog-slider-list-item").data("rowhidden", ""); $("#luckysheet-pivotTableFilter-menu, #luckysheet-pivotTableFilter-submenu").hide(); $("#luckysheet-pivotTableFilter-menu .luckysheet-pivotTableFilter-selected-input").hide().find("input").val(); - $("#luckysheet-pivotTableFilter-selected span").data("type", "0").data("type", null).text("无"); + $("#luckysheet-pivotTableFilter-selected span").data("type", "0").data("type", null).text(locale_filter.filiterInputNone); _this.setDatatojsfile("filterparm", null); _this.celldata = _this.origindata; @@ -1675,14 +1694,14 @@ const pivotTable = { day = "0" + day; } - let month = $(e).closest(".monthBox").find(".month label").text().replace("月", ""); + let month = $(e).closest(".monthBox").find(".month label").text().replace(locale_filter.filiterMonthText, ""); if(Number(month) < 10){ month = "0" + month; } - let year = $(e).closest(".yearBox").find(".year label").text().replace("年", ""); + let year = $(e).closest(".yearBox").find(".year label").text().replace(locale_filter.filiterYearText, ""); - let itemV = "日期格式#$$$#" + year + "-" + month + "-" + day; + let itemV = locale_filter.filterDateFormatTip+"#$$$#" + year + "-" + month + "-" + day; filterdata[itemV] = "1"; } @@ -1711,7 +1730,7 @@ const pivotTable = { } else if(cell.ct != null && cell.ct.t == "d"){ let fmt = update("YYYY-MM-DD", cell.v); - value = "日期格式#$$$#" + fmt; + value = locale_filter.filterDateFormatTip+"#$$$#" + fmt; } else{ value = cell.v + "#$$$#" + cell.m; @@ -1813,10 +1832,10 @@ const pivotTable = { if(Store.luckysheetfile[getSheetIndex(sheetIndex)].isPivotTable){ if(isEditMode()){ - alert("不可选择数据透视表为源数据!"); + alert(locale_pivotTable.errorNotAllowPivotData); } else{ - tooltip.info("选择失败", "不可选择数据透视表为源数据!"); + tooltip.info("", locale_pivotTable.errorNotAllowPivotData); } $input.val(_this.jgridCurrentPivotInput); return; @@ -1824,10 +1843,10 @@ const pivotTable = { if (rangetxt.indexOf(":") == -1) { if(isEditMode()){ - alert("选择失败, 输入范围错误!"); + alert(locale_pivotTable.errorSelectionRange); } else{ - tooltip.info("选择失败", "输入范围错误!"); + tooltip.info("", locale_pivotTable.errorSelectionRange); } $input.val(_this.jgridCurrentPivotInput); return; @@ -1841,10 +1860,10 @@ const pivotTable = { if (row[0] > row[1]) { if(isEditMode()){ - alert("选择失败, 输入范围错误!"); + alert(locale_pivotTable.errorSelectionRange); } else{ - tooltip.info("选择失败", "输入范围错误!"); + tooltip.info("", locale_pivotTable.errorSelectionRange); } $input.val(_this.jgridCurrentPivotInput); return; @@ -1855,10 +1874,10 @@ const pivotTable = { if (col[0] > col[1]) { if(isEditMode()){ - alert("选择失败, 输入范围错误!"); + alert(locale_pivotTable.errorSelectionRange); } else{ - tooltip.info("选择失败", "输入范围错误!"); + tooltip.info(locale_pivotTable.errorSelectionRange); } $input.val(_this.jgridCurrentPivotInput); return; @@ -1957,12 +1976,12 @@ const pivotTable = { let type = _this.pivot_data_type[_this.movesave.index.toString()]; if (type == "num") { - name = "求和:" + name; + name = locale_pivotTable.valueStatisticsSUM+":" + name; sumtype = "data-sumtype='SUM'"; nameindex = "data-nameindex='0'"; } else { - name = "计数:" + name; + name = locale_pivotTable.valueStatisticsCOUNTA+":" + name; sumtype = "data-sumtype='COUNTA'"; nameindex = "data-nameindex='0'"; } @@ -2109,10 +2128,10 @@ const pivotTable = { if (_this.celldata.length <= 1 && _this.celldata[0].length <= 1) { if(isEditMode()){ - alert("请扩大选择的数据范围!"); + alert(locale_pivotTable.errorIncreaseRange); } else{ - tooltip.info("提示", "请扩大选择的数据范围!"); + tooltip.info("", locale_pivotTable.errorIncreaseRange); } } @@ -2135,7 +2154,7 @@ const pivotTable = { } if (name == null || $.trim(name.toString()).length == 0) { - name = "列 " + selecteditemNullIndex; + name = locale_pivotTable.titleColumn+" " + selecteditemNullIndex; } selecteditemNullIndex++ @@ -2193,7 +2212,7 @@ const pivotTable = { style = "display:block;"; } - selecteditem += '
' + name + '
'; + selecteditem += '
' + name + '
'; } $("#luckysheet-modal-dialog-pivotTable-list").html(selecteditem); @@ -2414,19 +2433,22 @@ const pivotTable = { isAsc = true; } + const _locale = locale(); + const locale_filter = _locale.filter; + let a = function (x, y) { let f = null, s = null; if (orderby == "self" || orderby == null) { if(x.name == null){ - f = "(空白)"; + f = locale_filter.valueBlank; } else{ f = x.name.toString(); } if(y.name == null){ - s = "(空白)"; + s = locale_filter.valueBlank; } else{ s = y.name.toString(); @@ -2460,14 +2482,14 @@ const pivotTable = { if (orderby == "self" || orderby == null) { if(x.name == null){ - f = "(空白)"; + f = locale_filter.valueBlank; } else{ f = x.name.toString(); } if(y.name == null){ - s = "(空白)"; + s = locale_filter.valueBlank; } else{ s = y.name.toString(); @@ -2505,10 +2527,11 @@ const pivotTable = { }, generategroupaddstatic: function (arr, name) { let stasticarr = []; - + const _locale = locale(); + const locale_pivotTable = _locale.pivotTable; for (let a = 0; a < arr[0].length; a++) { if (a == 0) { - if (name == "总计") { + if (name == locale_pivotTable.valueSum) { stasticarr.push(name); } else { @@ -2625,6 +2648,11 @@ const pivotTable = { //values:[{"index":1, "sumtype":"SUM/COUNT/COUNTA/COUNTUNIQUE/AVERAGE/MAX/MIN/MEDIAN/PRODUCT/STDEV/STDEVP/let/VARP", "name":"求和:fyc"}] let _this = this; + const _locale = locale(); + const locale_filter = _locale.filter; + const locale_pivotTable = _locale.pivotTable; + + if (showType == null) { showType = "column"; } @@ -2665,27 +2693,27 @@ const pivotTable = { coltitle = _this.getComposeArray(coltitlename); if (rowtitle.length > 0) { - rowtitle.unshift("总计"); + rowtitle.unshift(locale_pivotTable.valueSum); } if (coltitle.length > 0) { - coltitle.unshift("总计"); + coltitle.unshift(locale_pivotTable.valueSum); } let curentLevelobj_row = datarowposition, curentLevelarr_row = datarowtitlegroup; for (let r = 0; r < rowtitle.length; r++) { - let item = rowtitle[r], name = r == 0 ? "总计" : rowtitlename[r - 1];//修改 + let item = rowtitle[r], name = r == 0 ? locale_pivotTable.valueSum : rowtitlename[r - 1];//修改 if (curentLevelobj_row[r.toString()] != null && curentLevelobj_row[r.toString()][item] != null) {//修改 curentLevelarr_row = curentLevelarr_row[curentLevelobj_row[r.toString()][item]].children; } else { - let orderby = r == 0 ? "self" : ((row[r - 1].orderby == "self" || row[r - 1].orderby == null) ? item : (showType == "column" ? item + values[parseInt(row[r - 1].orderby)].fullname : item + "总计")); + let orderby = r == 0 ? "self" : ((row[r - 1].orderby == "self" || row[r - 1].orderby == null) ? item : (showType == "column" ? item + values[parseInt(row[r - 1].orderby)].fullname : item + locale_pivotTable.valueSum)); if(name == null){ - name = "(空白)"; + name = locale_filter.valueBlank;; } curentLevelarr_row.push({ "name": name, "fullname": item, "index": r, "orderby": orderby, "children": [] }); @@ -2706,16 +2734,16 @@ const pivotTable = { curentLevelarr_col = datacoltitlegroup; for (let r = 0; r < coltitle.length; r++) { - let item = coltitle[r], name = r == 0 ? "总计" : coltitlename[r - 1]; + let item = coltitle[r], name = r == 0 ? locale_pivotTable.valueSum : coltitlename[r - 1]; if (curentLevelobj_col[r.toString()] != null && curentLevelobj_col[r.toString()][item] != null) { curentLevelarr_col = curentLevelarr_col[curentLevelobj_col[r.toString()][item]].children; } else { - let orderby = r == 0 ? "self" : ((column[r - 1].orderby == "self" || column[r - 1].orderby == null) ? item : (showType == "column" ? "总计" + item : values[parseInt(column[r - 1].orderby)].fullname + item)); + let orderby = r == 0 ? "self" : ((column[r - 1].orderby == "self" || column[r - 1].orderby == null) ? item : (showType == "column" ? locale_pivotTable.valueSum + item : values[parseInt(column[r - 1].orderby)].fullname + item)); if(name == null){ - name = "(空白)"; + name = locale_filter.valueBlank; } curentLevelarr_col.push({ "name": name, "fullname": item, "index": r, "orderby": orderby, "children": [] }); @@ -2887,7 +2915,7 @@ const pivotTable = { //列标题 if (datacoltitle[r] != null) { if (getObjType(datacoltitle[r][c - colOver]) == "object") { - retdata[r][c] = datacoltitle[r][c - colOver].name + "总计"; + retdata[r][c] = datacoltitle[r][c - colOver].name + locale_pivotTable.valueSum; } else { retdata[r][c] = datacoltitle[r][c - colOver]; @@ -2901,7 +2929,7 @@ const pivotTable = { //行标题 if (drt != null) { if (getObjType(drt[c]) == "object") { - retdata[r][c] = drt[c].name + "总计"; + retdata[r][c] = drt[c].name + locale_pivotTable.valueSum; } else { retdata[r][c] = drt[c]; @@ -2992,6 +3020,10 @@ const pivotTable = { let cell = _this.pivotDatas[row_index][col_index]; let d = $.extend(true, [], sheetmanage.nulldata); + const _locale = locale(); + const locale_filter = _locale.filter; + const locale_pivotTable = _locale.pivotTable; + let selecteditemNullIndex = 1; for(let i = 0; i < _this.celldata[0].length; i++){ let name; @@ -3007,7 +3039,7 @@ const pivotTable = { } if (name == null || $.trim(name.toString()).length == 0) { - name = "列 " + selecteditemNullIndex; + name = locale_pivotTable.titleColumn+" " + selecteditemNullIndex; } selecteditemNullIndex++ @@ -3047,7 +3079,7 @@ const pivotTable = { value = value.toString(); } else{ - value = "(空白)"; + value = locale_filter.valueBlank; } if(value != obj[x]){ diff --git a/src/locale/en.js b/src/locale/en.js index e933a23f7..9b30d324e 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -44,7 +44,7 @@ export default { pivotTable: 'PivotTable', chart: 'Chart', screenshot: 'Screenshot', - splitColumn: 'Split column', + splitColumn: 'Split text', clearText:"Clear color", noColorSelectedText:"No color is selected", @@ -472,6 +472,7 @@ export default { filterContainerOneColorTip:"This column contains only one color", filterDateFormatTip:"Date format", + valueBlank:"(Null)", }, rightclick: { copy: 'Copy', @@ -807,7 +808,71 @@ export default { offsetColumnLessZero:"The offset column cannot be negative!", }, pivotTable:{ - + title:"Pivot table", + closePannel:"Close", + editRange:"Select data range", + tipPivotFieldSelected:"Select the fields", + tipClearSelectedField:"Clear all fields", + btnClearSelectedField:"Clear", + btnFilter:"Filter", + titleRow:"Row", + titleColumn:"Column", + titleValue:"Value", + tipShowColumn:"Statistics fields are displayed as columns", + tipShowRow:"Statistics fields are displayed as rows", + + titleSelectionDataRange:"Select range", + titleDataRange:"Data range", + + valueSum:"Sum", + + valueStatisticsSUM:"Sum", + valueStatisticsCOUNT:"Count", + valueStatisticsCOUNTA:"CountA", + valueStatisticsCOUNTUNIQUE:"CountUnique", + valueStatisticsAVERAGE:"Average", + valueStatisticsMAX:"Max", + valueStatisticsMIN:"Min", + valueStatisticsMEDIAN:"Median", + valueStatisticsPRODUCT:"Product", + valueStatisticsSTDEV:"Stdev", + + valueStatisticsSTDEVP:"Stdevp", + valueStatisticslet:"Var", + valueStatisticsVARP:"VarP", + + errorNotAllowEdit:"This operation is prohibited in non-editing mode!", + errorNotAllowMulti:"Cannot perform this operation on multiple selection areas, please select a single range and try again", + errorSelectRange:"Please select the range of the new pivot table", + errorIsDamage:"The source data of this pivot table is corrupted!", + errorNotAllowPivotData:"Cannot select pivot table as source data!", + errorSelectionRange:"Selection failed, wrong input range!", + errorIncreaseRange:"Please expand the selected range!", + + titleAddColumn:"Add column to pivot table", + titleMoveColumn:"Move the column to the white box below", + titleClearColumnFilter:"Clear the filter for this column", + titleFilterColumn:"Filter", + + titleSort:"Sort", + titleNoSort:"No sort", + titleSortAsc:"ASC", + titleSortDesc:"DESC", + titleSortBy:"Sort by", + titleShowSum:"Show total", + titleStasticTrue:"Yes", + titleStasticFalse:"No", + }, + dropCell:{ + copyCell:"Copy", + sequence:"Sequence", + onlyFormat:"Only format", + noFormat:"Not format", + day:"Day", + workDay:"WorkDay", + month:"Month", + year:"Year", + chineseNumber:"Chinese numbers", } }; \ No newline at end of file diff --git a/src/locale/zh.js b/src/locale/zh.js index e5f8cb342..0527ae11c 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -497,6 +497,7 @@ export default { filterContainerOneColorTip:"本列仅包含一种颜色", filterDateFormatTip:"日期格式", + valueBlank:"(空白)", }, rightclick: { copy: '复制', @@ -831,6 +832,70 @@ export default { offsetColumnLessZero:"偏移列不能为负数!", }, pivotTable:{ - + title:"数据透视表", + closePannel:"关闭", + editRange:"编辑范围", + tipPivotFieldSelected:"选择需要添加到数据透视表的字段", + tipClearSelectedField:"清除所有已选字段", + btnClearSelectedField:"清除", + btnFilter:"筛选", + titleRow:"行", + titleColumn:"列", + titleValue:"数值", + tipShowColumn:"统计字段显示为列", + tipShowRow:"统计字段显示为行", + + titleSelectionDataRange:"选取数据范围", + titleDataRange:"数据范围", + + valueSum:"总计", + + valueStatisticsSUM:"求和", + valueStatisticsCOUNT:"数值计数", + valueStatisticsCOUNTA:"计数", + valueStatisticsCOUNTUNIQUE:"去重计数", + valueStatisticsAVERAGE:"平均值", + valueStatisticsMAX:"最大值", + valueStatisticsMIN:"最小值", + valueStatisticsMEDIAN:"中位数", + valueStatisticsPRODUCT:"乘积", + valueStatisticsSTDEV:"标准差", + + valueStatisticsSTDEVP:"整体标准差", + valueStatisticslet:"方差", + valueStatisticsVARP:"整体方差", + + errorNotAllowEdit:"非编辑模式下禁止该操作!", + errorNotAllowMulti:"不能对多重选择区域执行此操作,请选择单个区域,然后再试", + errorSelectRange:"请选择新建透视表的区域", + errorIsDamage:"此数据透视表的源数据已损坏!", + errorNotAllowPivotData:"不可选择数据透视表为源数据!", + errorSelectionRange:"选择失败, 输入范围错误!", + errorIncreaseRange:"请扩大选择的数据范围!", + + titleAddColumn:"添加列到数据透视表", + titleMoveColumn:"移动该列到下方白框", + titleClearColumnFilter:"清除该列的筛选条件", + titleFilterColumn:"筛选该列", + + titleSort:"排序", + titleNoSort:"无排序", + titleSortAsc:"升序", + titleSortDesc:"降序", + titleSortBy:"排序依据", + titleShowSum:"显示总计", + titleStasticTrue:"是", + titleStasticFalse:"否", + }, + dropCell:{ + copyCell:"复制单元格", + sequence:"填充序列", + onlyFormat:"仅填充格式", + noFormat:"不带格式填充", + day:"以天数填充", + workDay:"以工作日填充", + month:"以月填充", + year:"以年填充", + chineseNumber:"以中文小写数字填充", } };