Browse Source

feat(locale): locale

locale add zh,en
master
liurunze 5 years ago
parent
commit
4cd2ee4cb3
  1. 2
      demoData/sheetCell.js
  2. 2
      demoData/sheetComment.js
  3. 2
      demoData/sheetConditionFormat.js
  4. 2
      demoData/sheetFormula.js
  5. 203
      demoData/sheetPivotTable.js
  6. 755
      demoData/sheetPivotTableData.js
  7. 2
      demoData/sheetTable.js
  8. 6
      docs/guide/config.md
  9. 6
      docs/zh/guide/config.md
  10. 1
      gulpfile.js
  11. 5
      index.html
  12. 3
      src/config.js
  13. 586
      src/controllers/constant.js
  14. 1
      src/core.js
  15. 2
      src/global/createdom.js
  16. 67
      src/locale/en.js
  17. 14
      src/locale/locale.js
  18. 65
      src/locale/zh.js
  19. 1
      src/store/index.js

2
demoData/sheetCell.js

@ -1174,7 +1174,7 @@ const sheetCell = {
}],
"status": "1",
"order": "0",
"column": 12,
"column": 18,
"row": 36,
"celldata": [{
"r": 0,

2
demoData/sheetComment.js

@ -21,7 +21,7 @@ const sheetComment = {
}],
"status": "0",
"order": "4",
"column": 15,
"column": 18,
"row": 36,
"celldata": [{
"r": 2,

2
demoData/sheetConditionFormat.js

@ -168,7 +168,7 @@ const sheetConditionFormat = {
}],
"status": "0",
"order": "2",
"column": 15,
"column": 18,
"row": 36,
"celldata": [{
"r": 0,

2
demoData/sheetFormula.js

@ -99,7 +99,7 @@ const sheetFormula = {
}],
"status": "0",
"order": "1",
"column": 15,
"column": 18,
"row": 45,
"celldata": [{
"r": 0,

203
demoData/sheetPivotTable.js

@ -0,0 +1,203 @@
const sheetPivotTable = {
"name": "PivotTable",
"color": "",
"config": {},
"index": "6",
"chart": [{
"sheetIndex": "0",
"dataSheetIndex": "0",
"chartType": "column",
"row": "[1,3]",
"column": "[3,3]",
"chartStyle": "default",
"myWidth": "480",
"myHeight": "288",
"myLeft": "67",
"myTop": "11"
}],
"status": "0",
"order": "6",
"column": 18,
"row": 36,
"celldata": [{
"r": 0,
"c": 0,
"v": "计数:分数"
}, {
"r": 0,
"c": 1,
"v": "理综"
}, {
"r": 0,
"c": 2,
"v": "数学"
}, {
"r": 0,
"c": 3,
"v": "英语"
}, {
"r": 0,
"c": 4,
"v": "语文"
}, {
"r": 0,
"c": 5,
"v": "总计"
}, {
"r": 1,
"c": 0,
"v": "Alex"
}, {
"r": 1,
"c": 1,
"v": 1
}, {
"r": 1,
"c": 2,
"v": 1
}, {
"r": 1,
"c": 3,
"v": 1
}, {
"r": 1,
"c": 4,
"v": 1
}, {
"r": 1,
"c": 5,
"v": 4
}, {
"r": 2,
"c": 0,
"v": "Joy"
}, {
"r": 2,
"c": 1,
"v": 1
}, {
"r": 2,
"c": 2,
"v": 1
}, {
"r": 2,
"c": 3,
"v": 1
}, {
"r": 2,
"c": 4,
"v": 1
}, {
"r": 2,
"c": 5,
"v": 4
}, {
"r": 3,
"c": 0,
"v": "Tim"
}, {
"r": 3,
"c": 1,
"v": 1
}, {
"r": 3,
"c": 2,
"v": 1
}, {
"r": 3,
"c": 3,
"v": 1
}, {
"r": 3,
"c": 4,
"v": 1
}, {
"r": 3,
"c": 5,
"v": 4
}, {
"r": 4,
"c": 0,
"v": "总计"
}, {
"r": 4,
"c": 1,
"v": 3
}, {
"r": 4,
"c": 2,
"v": 3
}, {
"r": 4,
"c": 3,
"v": 3
}, {
"r": 4,
"c": 4,
"v": 3
}, {
"r": 4,
"c": 5,
"v": 12
}],
"visibledatarow": [],
"visibledatacolumn": [],
"rowsplit": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{
"row": [0, 0],
"column": [0, 0]
}],
"luckysheet_selection_range": [],
"scrollLeft": 0,
"scrollTop": 0,
"isPivotTable": true,
"pivotTable": {
"pivot_select_save": {
"left": 0,
"width": 73,
"top": 0,
"height": 19,
"left_move": 0,
"width_move": 369,
"top_move": 0,
"height_move": 259,
"row": [0, 12],
"column": [0, 4],
"row_focus": 0,
"column_focus": 0
},
"pivotDataSheetIndex": 5, //The sheet index where the source data is located
"column": [{
"index": 3,
"name": "科目",
"fullname": "科目"
}],
"row": [{
"index": 1,
"name": "学生",
"fullname": "学生"
}],
"filter": [],
"values": [{
"index": 4,
"name": "分数",
"fullname": "计数:分数",
"sumtype": "COUNTA",
"nameindex": 0
}],
"showType": "column",
"pivotDatas": [
["计数:分数", "理综", "数学", "英语", "语文", "总计"],
["Alex", 1, 1, 1, 1, 4],
["Joy", 1, 1, 1, 1, 4],
["Tim", 1, 1, 1, 1, 4],
["总计", 3, 3, 3, 3, 12]
],
"drawPivotTable": false,
"pivotTableBoundary": [5, 6]
}
}
export default sheetPivotTable;

755
demoData/sheetPivotTableData.js

@ -0,0 +1,755 @@
const sheetPivotTableData = {
"name": "PivotTableData",
"color": "",
"config": {
"merge": {}
},
"index": "5",
"chart": [{
"sheetIndex": "0",
"dataSheetIndex": "0",
"chartType": "column",
"row": "[1,3]",
"column": "[3,3]",
"chartStyle": "default",
"myWidth": "480",
"myHeight": "288",
"myLeft": "67",
"myTop": "11"
}],
"status": "0",
"order": "5",
"hide": 1,
"column": 18,
"row": 36,
"celldata": [{
"r": 0,
"c": 0,
"v": {
"m": "模考",
"ct": {
"fa": "General",
"t": "g"
},
"v": "模考"
}
}, {
"r": 0,
"c": 1,
"v": {
"m": "学生",
"ct": {
"fa": "General",
"t": "g"
},
"v": "学生"
}
}, {
"r": 0,
"c": 2,
"v": {
"m": "班级",
"ct": {
"fa": "General",
"t": "g"
},
"v": "班级"
}
}, {
"r": 0,
"c": 3,
"v": {
"m": "科目",
"ct": {
"fa": "General",
"t": "g"
},
"v": "科目"
}
}, {
"r": 0,
"c": 4,
"v": {
"m": "分数",
"ct": {
"fa": "General",
"t": "g"
},
"v": "分数"
}
}, {
"r": 1,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 1,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Joy",
"m": "Joy"
}
}, {
"r": 1,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 1,
"c": 3,
"v": {
"m": "语文",
"ct": {
"fa": "General",
"t": "g"
},
"v": "语文"
}
}, {
"r": 1,
"c": 4,
"v": {
"v": 96,
"ct": {
"fa": "General",
"t": "n"
},
"m": "96"
}
}, {
"r": 2,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 2,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Joy",
"m": "Joy"
}
}, {
"r": 2,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 2,
"c": 3,
"v": {
"m": "数学",
"ct": {
"fa": "General",
"t": "g"
},
"v": "数学"
}
}, {
"r": 2,
"c": 4,
"v": {
"v": 110,
"ct": {
"fa": "General",
"t": "n"
},
"m": "110"
}
}, {
"r": 3,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 3,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Joy",
"m": "Joy"
}
}, {
"r": 3,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 3,
"c": 3,
"v": {
"m": "英语",
"ct": {
"fa": "General",
"t": "g"
},
"v": "英语"
}
}, {
"r": 3,
"c": 4,
"v": {
"v": 87,
"ct": {
"fa": "General",
"t": "n"
},
"m": "87"
}
}, {
"r": 4,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 4,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Joy",
"m": "Joy"
}
}, {
"r": 4,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 4,
"c": 3,
"v": {
"m": "理综",
"ct": {
"fa": "General",
"t": "g"
},
"v": "理综"
}
}, {
"r": 4,
"c": 4,
"v": {
"v": 266,
"ct": {
"fa": "General",
"t": "n"
},
"m": "266"
}
}, {
"r": 5,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 5,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Tim",
"m": "Tim"
}
}, {
"r": 5,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 5,
"c": 3,
"v": {
"m": "语文",
"ct": {
"fa": "General",
"t": "g"
},
"v": "语文"
}
}, {
"r": 5,
"c": 4,
"v": {
"v": 92,
"ct": {
"fa": "General",
"t": "n"
},
"m": "92"
}
}, {
"r": 6,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 6,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Tim",
"m": "Tim"
}
}, {
"r": 6,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 6,
"c": 3,
"v": {
"m": "数学",
"ct": {
"fa": "General",
"t": "g"
},
"v": "数学"
}
}, {
"r": 6,
"c": 4,
"v": {
"v": 100,
"ct": {
"fa": "General",
"t": "n"
},
"m": "100"
}
}, {
"r": 7,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 7,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Tim",
"m": "Tim"
}
}, {
"r": 7,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 7,
"c": 3,
"v": {
"m": "英语",
"ct": {
"fa": "General",
"t": "g"
},
"v": "英语"
}
}, {
"r": 7,
"c": 4,
"v": {
"v": 90,
"ct": {
"fa": "General",
"t": "n"
},
"m": "90"
}
}, {
"r": 8,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 8,
"c": 1,
"v": {
"ct": {
"fa": "General",
"t": "g"
},
"v": "Tim",
"m": "Tim"
}
}, {
"r": 8,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 8,
"c": 3,
"v": {
"m": "理综",
"ct": {
"fa": "General",
"t": "g"
},
"v": "理综"
}
}, {
"r": 8,
"c": 4,
"v": {
"v": 255,
"ct": {
"fa": "General",
"t": "n"
},
"m": "255"
}
}, {
"r": 9,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 9,
"c": 1,
"v": {
"m": "Alex",
"ct": {
"fa": "General",
"t": "g"
},
"v": "Alex"
}
}, {
"r": 9,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 9,
"c": 3,
"v": {
"m": "语文",
"ct": {
"fa": "General",
"t": "g"
},
"v": "语文"
}
}, {
"r": 9,
"c": 4,
"v": {
"v": 108,
"ct": {
"fa": "General",
"t": "n"
},
"m": "108"
}
}, {
"r": 10,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 10,
"c": 1,
"v": {
"m": "Alex",
"ct": {
"fa": "General",
"t": "g"
},
"v": "Alex"
}
}, {
"r": 10,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 10,
"c": 3,
"v": {
"m": "数学",
"ct": {
"fa": "General",
"t": "g"
},
"v": "数学"
}
}, {
"r": 10,
"c": 4,
"v": {
"v": 117,
"ct": {
"fa": "General",
"t": "n"
},
"m": "117"
}
}, {
"r": 11,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 11,
"c": 1,
"v": {
"m": "Alex",
"ct": {
"fa": "General",
"t": "g"
},
"v": "Alex"
}
}, {
"r": 11,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 11,
"c": 3,
"v": {
"m": "英语",
"ct": {
"fa": "General",
"t": "g"
},
"v": "英语"
}
}, {
"r": 11,
"c": 4,
"v": {
"v": 88,
"ct": {
"fa": "General",
"t": "n"
},
"m": "88"
}
}, {
"r": 12,
"c": 0,
"v": {
"m": "第一轮",
"ct": {
"fa": "General",
"t": "g"
},
"v": "第一轮"
}
}, {
"r": 12,
"c": 1,
"v": {
"m": "Alex",
"ct": {
"fa": "General",
"t": "g"
},
"v": "Alex"
}
}, {
"r": 12,
"c": 2,
"v": {
"m": "一班",
"ct": {
"fa": "General",
"t": "g"
},
"v": "一班"
}
}, {
"r": 12,
"c": 3,
"v": {
"m": "理综",
"ct": {
"fa": "General",
"t": "g"
},
"v": "理综"
}
}, {
"r": 12,
"c": 4,
"v": {
"v": 278,
"ct": {
"fa": "General",
"t": "n"
},
"m": "278"
}
}],
"visibledatarow": [],
"visibledatacolumn": [],
"rowsplit": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{
"row": [0, 0],
"column": [0, 0]
}],
"luckysheet_selection_range": [],
"scrollLeft": 0,
"scrollTop": 0
}
export default sheetPivotTableData;

2
demoData/sheetTable.js

@ -56,7 +56,7 @@ const sheetTable = {
}],
"status": "0",
"order": "3",
"column": 15,
"column": 18,
"row": 36,
"celldata": [{
"r": 0,

6
docs/guide/config.md

@ -79,12 +79,6 @@
- Default: true
- Usage: Whether to display the bottom count bar
------------
## editMode
- Type: Boolean
- Default: false
- Usage: Whether it is edit mode
------------
## allowEdit
- Type: Boolean

6
docs/zh/guide/config.md

@ -79,12 +79,6 @@
- 默认值:true
- 作用:是否显示底部计数栏
------------
## editMode
- 类型:Boolean
- 默认值:false
- 作用:是否为编辑模式
------------
## allowEdit
- 类型:Boolean

1
gulpfile.js

@ -63,6 +63,7 @@ function watchReload() {
if (reloadTimer !== null) {
clearTimeout(reloadTimer);
return;
}
reloadTimer = setTimeout(() => {

5
index.html

@ -53,11 +53,14 @@
import sheetConditionFormat from './demoData/sheetConditionFormat.js'
import sheetTable from './demoData/sheetTable.js'
import sheetComment from './demoData/sheetComment.js'
import sheetPivotTableData from './demoData/sheetPivotTableData.js'
import sheetPivotTable from './demoData/sheetPivotTable.js'
$(function () {
luckysheet.create({
container: 'luckysheet',
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetComment]
lang: 'zh',
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable]
})
})

3
src/config.js

@ -49,5 +49,6 @@ export default {
editMode: false, //是否为编辑模式
chartConfigChange: null,//图表插件中图表更新触发的自定义方法
beforeCreateDom: null,//表格创建之前的方法
fireMousedown: null //单元格数据下钻
fireMousedown: null, //单元格数据下钻
lang: 'en', //language
}

586
src/controllers/constant.js

File diff suppressed because one or more lines are too long

1
src/core.js

@ -23,6 +23,7 @@ luckysheet.create = function (setting) {
Store.defaultcolumnNum = extendsetting.column;
Store.defaultrowNum = extendsetting.row;
Store.fullscreenmode = extendsetting.fullscreenmode;
Store.lang = extendsetting.lang; //language
server.gridKey = extendsetting.gridKey;
server.loadUrl = extendsetting.loadUrl;

2
src/global/createdom.js

@ -32,7 +32,7 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
let gh = gridHTML;
gh = replaceHtml(gh, { "logotitle": title });//设置title
gh = replaceHtml(gh, { "menu": menuToolBar });//设置需要显示的菜单
gh = replaceHtml(gh, { "menu": menuToolBar() });//设置需要显示的菜单
if (data.length == 0) {
Store.flowdata = datagridgrowth(data, rowheight, colwidth);

67
src/locale/en.js

@ -0,0 +1,67 @@
export default {
toolbar: {
undo: 'Undo',
redo: 'Redo',
paintFormat: 'Paint format',
currencyFormat: 'Format as currency',
percentageFormat: 'Format as percent',
decreaseDecimal: 'Decrease decimal places',
increaseDecimal: 'Increase decimal places',
moreFormats:'More formats',
font: 'Font',
fontSize: 'Font size',
bold: 'Bold (Ctrl+B)',
italic : 'Italic (Ctrl+I)',
strikethrough: 'Strikethrough (Alt+Shift+5)',
textColor: 'Text color',
chooseColor: 'choose color',
resetColor: 'Reset',
customColor: 'CUSTOM',
alternatingColors: 'Alternating colors',
confirmColor: 'OK',
cancelColor: 'Cancel',
collapse: 'Collapse',
fillColor: 'Fill color',
},
alternatingColors:{
applyRange: 'Apply to range',
selectRange: 'Select a data range',
header: 'Header',
footer: 'Footer',
},
button: {
confirm: 'OK',
cancel: 'Cancel',
},
tooltip:{
paintFormatStart: 'Paint format start',
paintFormatEnd: 'ESC key to exit',
},
format:{
auto: 'Automatic',
text: 'Plain text',
number: 'Number',
percent: 'Percent',
scientific: 'Scientific',
accounting: 'Accounting',
tenThousand: 'Ten thousand',
currency: 'Currency',
tenThousandDecimal: 'Ten thousand (2 decimal places)',
date: 'Date',
time: 'Time',
time24H: 'Time 24H',
dateTime: 'Date time',
dateTime24H: 'Date time 24 H',
customFormats: 'Custom formats',
moreCurrency: 'More currency formats',
moreDateTime: 'More date and time formats',
moreNumber: 'More number formats',
},
info:{
detailUpdate: 'New opened',
detailSave: 'Local cache restored',
row: 'row',
column: 'column'
}
};

14
src/locale/locale.js

@ -0,0 +1,14 @@
import en from './en'
import zh from './zh'
import Store from '../store';
const localeObj = {
'en':en,
'zh':zh
}
function locale(){
return localeObj[Store.lang];
}
export default locale;

65
src/locale/zh.js

@ -0,0 +1,65 @@
export default {
toolbar: {
undo: '撤销',
redo: '重做',
paintFormat: '格式刷',
currencyFormat: '货币格式',
percentageFormat: '百分比格式',
numberDecrease: '减少小数位数',
numberIncrease: '增加小数位数',
moreFormats: '更多格式',
font: '字体',
fontSize: '字号大小',
bold: '粗体 (Ctrl+B)',
Italic: '斜体 (Ctrl+I)',
strikethrough: '删除线 (Alt+Shift+5)',
textColor: '文本颜色',
chooseColor: '颜色选择',
resetColor: '重置颜色',
customColor: '自定义',
alternatingColors: '交替颜色',
confirmColor: '确定颜色',
collapse: '收起',
fillColor: '单元格颜色',
},
alternatingColors:{
applyRange: '应用范围',
selectRange: '选择应用范围',
header: '页眉',
footer: '页脚',
},
button: {
confirm: '确定',
cancel: '取消',
},
tooltip: {
paintFormatStart: '格式刷开启',
paintFormatEnd: 'ESC键退出',
},
format: {
auto: '自动',
text: '纯文本',
number: '数字',
percent: '百分比',
scientific: '科学计数',
accounting: '会计',
tenThousand: '万元',
currency: '货币',
tenThousandDecimal: '万元2位小数',
date: '日期',
time: '时间',
time24H: '时间24H',
dateTime: '日期时间',
dateTime24H: '日期时间24H',
customFormats: '自定义格式',
moreCurrency: '更多货币格式',
moreDateTime: '更多日期与时间格式',
moreNumber: '更多数字格式'
},
info: {
detailUpdate: '新打开',
detailSave: '已恢复本地缓存',
row: '行',
column: '列'
}
};

1
src/store/index.js

@ -81,6 +81,7 @@ const Store = {
clearjfundo: true,
jfredo: [],
jfundo: [],
lang: 'en', //language
}
export default Store;
Loading…
Cancel
Save