Browse Source

国际化

master
liuyang 5 years ago
parent
commit
60331412c3
  1. 2
      src/controllers/alternateformat.js
  2. 62
      src/controllers/constant.js
  3. 108
      src/controllers/menuButton.js
  4. 273
      src/controllers/moreFormat.js
  5. 2
      src/index.html
  6. 259
      src/locale/en.js
  7. 284
      src/locale/zh.js
  8. 13
      src/utils/util.js

2
src/controllers/alternateformat.js

@ -264,7 +264,7 @@ const alternateformat = {
let _this = this; let _this = this;
$("#luckysheet-modal-dialog-slider-alternateformat").remove(); $("#luckysheet-modal-dialog-slider-alternateformat").remove();
$("body").append(luckysheetAlternateformatHtml); $("body").append(luckysheetAlternateformatHtml());
luckysheetsizeauto(); luckysheetsizeauto();
//关闭 //关闭

62
src/controllers/constant.js

File diff suppressed because one or more lines are too long

108
src/controllers/menuButton.js

@ -31,12 +31,14 @@ import { getSheetIndex, getRangetxt, getluckysheetfile } from '../methods/get';
import { setluckysheetfile } from '../methods/set'; import { setluckysheetfile } from '../methods/set';
import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat } from '../utils/util'; import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat } from '../utils/util';
import Store from '../store'; import Store from '../store';
import locale from '../locale/locale';
import { connect } from 'tls';
const menuButton = { const menuButton = {
"menu": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton ${subclass} luckysheet-mousedown-cancel" id="luckysheet-icon-${id}-menuButton">${item}</div>', "menu": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton ${subclass} luckysheet-mousedown-cancel" id="luckysheet-icon-${id}-menuButton">${item}</div>',
"item": '<div itemvalue="${value}" itemname="${name}" class="luckysheet-cols-menuitem ${sub} luckysheet-mousedown-cancel"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel" style="padding: 3px 0px 3px 1px;"><span style="margin-right:3px;width:13px;display:inline-block;" class="icon luckysheet-mousedown-cancel"></span> ${name} <span class="luckysheet-submenu-arrow luckysheet-mousedown-cancel" style="user-select: none;">${example}</span></div></div>', "item": '<div itemvalue="${value}" itemname="${name}" class="luckysheet-cols-menuitem ${sub} luckysheet-mousedown-cancel"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel" style="padding: 3px 0px 3px 1px;"><span style="margin-right:3px;width:13px;display:inline-block;" class="icon luckysheet-mousedown-cancel"></span> ${name} <span class="luckysheet-submenu-arrow luckysheet-mousedown-cancel" style="user-select: none;">${example}</span></div></div>',
"split": '<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>', "split": '<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>',
"color": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-mousedown-cancel luckysheet-menuButton ${sub}" id="${id}"><div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel luckysheet-color-reset"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">重置颜色</div></div> <div class="luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <input type="text" class="luckysheet-color-selected" /> </div> </div> <div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div> ${coloritem}</div>', "color": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-mousedown-cancel luckysheet-menuButton ${sub}" id="${id}"><div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel luckysheet-color-reset"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${resetColor}</div></div> <div class="luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <input type="text" class="luckysheet-color-selected" /> </div> </div> <div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div> ${coloritem}</div>',
"coloritem": '<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel ${class}"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${name}</div></div>', "coloritem": '<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel ${class}"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${name}</div></div>',
"subcolor": '<div id="luckysheet-icon-${id}-menuButton" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-menuButton-sub luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <input type="text" class="luckysheet-color-selected" /> </div> </div></div>', "subcolor": '<div id="luckysheet-icon-${id}-menuButton" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-menuButton-sub luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <input type="text" class="luckysheet-color-selected" /> </div> </div></div>',
"rightclickmenu": null, "rightclickmenu": null,
@ -380,33 +382,15 @@ const menuButton = {
//更多格式 //更多格式
$("#luckysheet-icon-fmt-other").click(function(){ $("#luckysheet-icon-fmt-other").click(function(){
const _locale = locale();
const locale_format = _locale.format;
const locale_defaultFmt = _locale.defaultFmt;
let menuButtonId = $(this).attr("id")+"-menuButton"; let menuButtonId = $(this).attr("id")+"-menuButton";
let $menuButton = $("#" + menuButtonId); let $menuButton = $("#" + menuButtonId);
if($menuButton.length == 0){ if($menuButton.length == 0){
let itemdata = [ let itemdata = locale_defaultFmt;
{ "text": "自动", "value": "General", "example": "" },
{ "text": "纯文本", "value": "@", "example": "" },
{ "text": "", "value": "split", "example": "" },
{ "text": "数字", "value": "##0.00", "example": "1000.12" },
{ "text": "百分比", "value": "#0.00%", "example": "12.21%" },
{ "text": "科学计数", "value": "0.00E+00", "example": "1.01E+5" },
{ "text": "", "value": "split", "example": "" },
{ "text": "会计", "value": "¥(0.00)", "example": "¥(1200.09)" },
//{ "text": "财务", "value": "(#.####)", "example": "(1200.09)" },
{ "text": "万元", "value": "w", "example": "1亿2000万2500" },
{ "text": "货币", "value": "¥0.00", "example": "¥1200.09" },
//{ "text": "货币整数", "value": "¥####", "example": "¥1200" },
{ "text": "万元2位小数", "value": "w0.00", "example": "2万2500.55" },
{ "text": "", "value": "split", "example": "" },
{ "text": "日期", "value": "yyyy-MM-dd", "example": "2017-11-29" },
{ "text": "时间", "value": "hh:mm AM/PM", "example": "3:00 PM" },
{ "text": "时间24H", "value": "hh:mm", "example": "15:00" },
{ "text": "日期时间", "value": "yyyy-MM-dd hh:mm AM/PM", "example": "2017-11-29 3:00 PM" },
{ "text": "日期时间24H", "value": "yyyy-MM-dd hh:mm", "example": "2017-11-29 15:00" },
{ "text": "", "value": "split", "example": "" },
{ "text": "自定义格式", "value": "fmtOtherSelf", "example": "more" }
];
let itemset = _this.createButtonMenu(itemdata); let itemset = _this.createButtonMenu(itemdata);
@ -414,9 +398,9 @@ const menuButton = {
let menu = replaceHtml(_this.menu, {"id": "fmt-other", "item": itemset, "subclass": "", "sub": ""}); let menu = replaceHtml(_this.menu, {"id": "fmt-other", "item": itemset, "subclass": "", "sub": ""});
let subitemdata = [ let subitemdata = [
{"text":"更多货币格式...", "value":"morecurrency", "example":""}, {"text":locale_format.moreCurrency+"...", "value":"morecurrency", "example":""},
{"text":"更多日期与时间格式...", "value":"moredatetime", "example":""}, {"text":locale_format.moreDateTime+"...", "value":"moredatetime", "example":""},
{"text":"更多数字格式...", "value":"moredigit", "example":""} {"text":locale_format.moreNumber+"...", "value":"moredigit", "example":""}
]; ];
let subitemset = _this.createButtonMenu(subitemdata); let subitemset = _this.createButtonMenu(subitemdata);
let submenu = replaceHtml(_this.menu, {"id": "fmtOtherSelf", "item": subitemset, "subclass": "luckysheet-menuButton-sub"}); let submenu = replaceHtml(_this.menu, {"id": "fmtOtherSelf", "item": subitemset, "subclass": "luckysheet-menuButton-sub"});
@ -469,30 +453,25 @@ const menuButton = {
$("#luckysheet-icon-font-family").click(function(){ $("#luckysheet-icon-font-family").click(function(){
let menuButtonId = $(this).attr("id")+"-menuButton"; let menuButtonId = $(this).attr("id")+"-menuButton";
let $menuButton = $("#"+menuButtonId); let $menuButton = $("#"+menuButtonId);
if($menuButton.length == 0){ if($menuButton.length == 0){
let itemdata = [ const locale_fontarray = locale().fontarray;
{ "value": "0", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:微软雅黑'>微软雅黑</span>", "example": "" }, let itemdata = [];
{ "value": "1", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:宋体'>宋体</span>", "example": "" },
{ "value": "2", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:黑体'>黑体</span>", "example": "" }, for(let a=0;a<locale_fontarray.length;a++){
{ "value": "3", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:楷体'>楷体</span>", "example": "" }, let fItem = locale_fontarray[a];
{ "value": "4", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:仿宋'>仿宋</span>", "example": "" }, let ret = {};
{ "value": "5", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:新宋体'>新宋体</span>", "example": "" }, ret.value = a;
{ "value": "6", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:华文新魏'>华文新魏</span>", "example": "" }, ret.text = "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:"+fItem+"'>"+fItem+"</span>";
{ "value": "7", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:华文行楷'>华文行楷</span>", "example": "" }, ret.example = "";
{ "value": "8", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:华文隶书'>华文隶书</span>", "example": "" }, itemdata.push(ret);
{ "value": "9", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:Arial'>Arial</span>", "example": "" }, }
{ "value": "10", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:Times New Roman'>Times New Roman</span>", "example": "" },
{ "value": "11", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:Tahoma'>Tahoma</span>", "example": "" },
{ "value": "12", "text": "<span class='luckysheet-mousedown-cancel' style='font-size:16px;font-family:Verdana'>Verdana</span>", "example": "" }
];
let itemset = _this.createButtonMenu(itemdata); let itemset = _this.createButtonMenu(itemdata);
let menu = replaceHtml(_this.menu, {"id": "font-family", "item": itemset, "subclass": "", "sub": ""}); let menu = replaceHtml(_this.menu, {"id": "font-family", "item": itemset, "subclass": "", "sub": ""});
$("body").append(menu); $("body").append(menu);
$menuButton = $("#"+menuButtonId).width(150); $menuButton = $("#"+menuButtonId).width(200);
_this.focus($menuButton); _this.focus($menuButton);
$menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.find(".luckysheet-cols-menuitem").click(function(){
@ -534,14 +513,18 @@ const menuButton = {
let $menuButton = $("#"+menuButtonId); let $menuButton = $("#"+menuButtonId);
if($menuButton.length == 0){ if($menuButton.length == 0){
const _locale = locale();
const locale_toolbar = _locale.toolbar;
const locale_button = _locale.button;
const locale_alternatingColors = _locale.alternatingColors;
let itemdata = [ let itemdata = [
{"name":"交替颜色...", "id":"luckysheet-color-alternate", "example":""} {"name":locale_toolbar.alternatingColors+"...", "id":"luckysheet-color-alternate", "example":""}
]; ];
let itemset = _this.createButtonMenu(itemdata); let itemset = _this.createButtonMenu(itemdata);
let subid = "text-color-self"; let subid = "text-color-self";
let coloritem = replaceHtml(_this.coloritem, {"class": "luckysheet-icon-alternateformat", "name": "交替颜色..."}); let coloritem = replaceHtml(_this.coloritem, {"class": "luckysheet-icon-alternateformat", "name": locale_toolbar.alternatingColors+"..."});
let menu = replaceHtml(_this.color, {"id":menuButtonId, "coloritem": coloritem, "colorself": subid, "sub": ""}); let menu = replaceHtml(_this.color, {"id":menuButtonId, "coloritem": coloritem, "colorself": subid, "sub": "","resetColor":locale_toolbar.resetColor});
$("body").append(menu); $("body").append(menu);
$menuButton = $("#" + menuButtonId); $menuButton = $("#" + menuButtonId);
@ -558,14 +541,14 @@ const menuButton = {
showSelectionPalette: true, showSelectionPalette: true,
maxPaletteSize: 8, maxPaletteSize: 8,
maxSelectionSize: 8, maxSelectionSize: 8,
cancelText: "取消", cancelText: locale_button.cancel,
chooseText: "确定颜色", chooseText: locale_button.confirm,
togglePaletteMoreText: "自定义", togglePaletteMoreText: locale_toolbar.customColor,
togglePaletteLessText: "收起", togglePaletteLessText: locale_toolbar.collapse,
togglePaletteOnly: true, togglePaletteOnly: true,
clearText: "清除颜色选择", clearText: locale_toolbar.clearText,
color:"#000", color:"#000",
noColorSelectedText: "没有颜色被选择", noColorSelectedText: locale_toolbar.noColorSelectedText,
localStorageKey: "spectrum.textcolor" + server.gridKey, localStorageKey: "spectrum.textcolor" + server.gridKey,
palette: [["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"], palette: [["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"], ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
@ -2696,8 +2679,6 @@ const menuButton = {
} }
}); });
}, },
fontarray: ["微软雅黑","宋体","黑体","楷体","仿宋","新宋体","华文新魏","华文行楷","华文隶书","Arial","Times New Roman","Tahoma","Verdana"],
fontjson: {"微软雅黑":0,"microsoft yahei":0,"宋体":1,"simsun":1,"黑体":2,"simhei":2,"楷体":3,"kaiti":3,"仿宋":4,"fangsong":4,"新宋体":5,"nsimsun":5,"华文新魏":6,"stxinwei":6,"华文行楷":7,"stxingkai":7,"华文隶书":8,"stliti":8,"arial":9,"times new roman":10,"tahoma":11,"verdana":12},
getQKBorder: function(width, type, color){ getQKBorder: function(width, type, color){
let bordertype = ""; let bordertype = "";
if(width.indexOf("pt") > -1){ if(width.indexOf("pt") > -1){
@ -3326,6 +3307,7 @@ const menuButton = {
menuButtonFocus: function(d, r, c){ menuButtonFocus: function(d, r, c){
let _this = this; let _this = this;
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr"]; let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr"];
const locale_fontarray = locale().fontarray;
for(let i = 0; i < foucsList.length; i++){ for(let i = 0; i < foucsList.length; i++){
let attr = foucsList[i]; let attr = foucsList[i];
@ -3358,16 +3340,16 @@ const menuButton = {
else if(attr == "ff"){ else if(attr == "ff"){
let menuButtonId = "luckysheet-icon-font-family-menuButton"; let menuButtonId = "luckysheet-icon-font-family-menuButton";
let $menuButton = $("#" + menuButtonId); let $menuButton = $("#" + menuButtonId);
let itemname = "微软雅黑", itemvalue = 0; const locale_fontarray = locale().fontarray;
let itemname = locale_fontarray[0], itemvalue = 0;
if(foucsStatus != null){ if(foucsStatus != null){
if(isdatatypemulti(foucsStatus)["num"]){ if(isdatatypemulti(foucsStatus)["num"]){
itemvalue = parseInt(foucsStatus); itemvalue = parseInt(foucsStatus);
itemname = _this.fontarray[itemvalue]; itemname = locale_fontarray[itemvalue];
} }
else{ else{
itemvalue = _this.fontjson[foucsStatus]; itemvalue = _this.fontjson[foucsStatus];
itemname = _this.fontarray[itemvalue]; itemname = locale_fontarray[itemvalue];
} }
} }
@ -3974,7 +3956,9 @@ const menuButton = {
}, },
getTextHeightCache: {}, getTextHeightCache: {},
getTextSize: function(text, font){ getTextSize: function(text, font){
let f = font || '10pt 微软雅黑'; let fontarray = locale().fontarray;
let f = font || '10pt ' + fontarray[0];
let _this = this; let _this = this;
if (f in _this.getTextHeightCache){ if (f in _this.getTextHeightCache){
@ -4364,6 +4348,8 @@ const menuButton = {
let cf_compute = conditionformat.getComputeMap(); let cf_compute = conditionformat.getComputeMap();
let checksCF = conditionformat.checksCF(r, c, cf_compute); let checksCF = conditionformat.checksCF(r, c, cf_compute);
const locale_fontarray = locale().fontarray;
let cell = d[r][c]; let cell = d[r][c];
for(let key in cell){ for(let key in cell){
let value = _this.checkstatus(d, r, c , key); let value = _this.checkstatus(d, r, c , key);
@ -4404,7 +4390,7 @@ const menuButton = {
if(key == "ff" && value != "0"){ if(key == "ff" && value != "0"){
let f = value; let f = value;
if(!isNaN(parseInt(value))){ if(!isNaN(parseInt(value))){
f = _this.fontarray[parseInt(value)]; f = locale_fontarray[parseInt(value)];
} }
style += "font-family: " + f + ";"; style += "font-family: " + f + ";";
} }

273
src/controllers/moreFormat.js

@ -5,6 +5,7 @@ import editor from '../global/editor';
import tooltip from '../global/tooltip'; import tooltip from '../global/tooltip';
import { isEditMode } from '../global/validate'; import { isEditMode } from '../global/validate';
import Store from '../store'; import Store from '../store';
import locale from '../locale/locale';
//更多格式 //更多格式
const luckysheetMoreFormat = { const luckysheetMoreFormat = {
@ -795,13 +796,275 @@ const luckysheetMoreFormat = {
createDialog: function(type){ createDialog: function(type){
let _this = this; let _this = this;
const currencyDetail = locale().currencyDetail;
const locale_format = locale().format;
const locale_button = locale().button;
this.moneyFmtList = [
{'name': currencyDetail.RMB,'pos': 'before','value': '¥'},
{'name': currencyDetail.USdollar,'pos': 'before','value': '$'},
{'name': currencyDetail.EUR,'pos': 'before','value': '€'},
{'name': currencyDetail.GBP,'pos': 'before','value': '£'},
{'name': currencyDetail.HK,'pos': 'before','value': '$'},
{'name': currencyDetail.JPY,'pos': 'before','value': '¥'},
{'name': currencyDetail.AlbanianLek,'pos': 'before','value': 'Lek'},
{'name': currencyDetail.AlgerianDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.Afghani,'pos': 'after','value': 'Af'},
{'name': currencyDetail.ArgentinePeso,'pos': 'before','value': '$'},
{'name': currencyDetail.UnitedArabEmiratesDirham,'pos': 'before','value': 'dh'},
{'name': currencyDetail.ArubanFlorin,'pos': 'before','value': 'Afl'},
{'name': currencyDetail.OmaniRial,'pos': 'before','value': 'Rial'},
{'name': currencyDetail.Azerbaijanimanat,'pos': 'before','value': '?'},
{'name': currencyDetail.EgyptianPound,'pos': 'before','value': '£'},
{'name': currencyDetail.EthiopianBirr,'pos': 'before','value': 'Birr'},
{'name': currencyDetail.AngolaKwanza,'pos': 'before','value': 'Kz'},
{'name': currencyDetail.AustralianDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.Patacas,'pos': 'before','value': 'MOP'},
{'name': currencyDetail.BarbadosDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.PapuaNewGuineaKina,'pos': 'before','value': 'PGK'},
{'name': currencyDetail.BahamianDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.PakistanRupee,'pos': 'before','value': 'Rs'},
{'name': currencyDetail.ParaguayanGuarani,'pos': 'after','value': 'Gs'},
{'name': currencyDetail.BahrainiDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.PanamanianBalboa,'pos': 'before','value': 'B/'},
{'name': currencyDetail.Brazilianreal,'pos': 'before','value': 'R$'},
{'name': currencyDetail.Belarusianruble,'pos': 'after','value': 'р'},
{'name': currencyDetail.BermudianDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.BulgarianLev,'pos': 'before','value': 'lev'},
{'name': currencyDetail.IcelandKrona,'pos': 'before','value': 'kr'},
{'name': currencyDetail.BosniaHerzegovinaConvertibleMark,'pos': 'before','value': 'KM'},
{'name': currencyDetail.PolishZloty,'pos': 'after','value': 'z?'},
{'name': currencyDetail.Boliviano,'pos': 'before','value': 'Bs'},
{'name': currencyDetail.BelizeDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.BotswanaPula,'pos': 'before','value': 'P'},
{'name': currencyDetail.NotDannuzhamu,'pos': 'before','value': 'Nu'},
{'name': currencyDetail.BurundiFranc,'pos': 'before','value': 'FBu'},
{'name': currencyDetail.NorthKoreanWon,'pos': 'before','value': '?KP'},
{'name': currencyDetail.DanishKrone,'pos': 'after','value': 'kr'},
{'name': currencyDetail.EastCaribbeanDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.DominicaPeso,'pos': 'before','value': 'RD$'},
{'name': currencyDetail.RussianRuble,'pos': 'after','value': '?'},
{'name': currencyDetail.EritreanNakfa,'pos': 'before','value': 'Nfk'},
{'name': currencyDetail.CFAfranc,'pos': 'before','value': 'CFA'},
{'name': currencyDetail.PhilippinePeso,'pos': 'before','value': '?'},
{'name': currencyDetail.FijiDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.CapeVerdeEscudo,'pos': 'before','value': 'CVE'},
{'name': currencyDetail.FalklandIslandsPound,'pos': 'before','value': '£'},
{'name': currencyDetail.GambianDalasi,'pos': 'before','value': 'GMD'},
{'name': currencyDetail.Congolesefranc,'pos': 'before','value': 'FrCD'},
{'name': currencyDetail.ColombianPeso,'pos': 'before','value': '$'},
{'name': currencyDetail.CostaRicanColon,'pos': 'before','value': '?'},
{'name': currencyDetail.CubanPeso,'pos': 'before','value': '$'},
{'name': currencyDetail.Cubanconvertiblepeso,'pos': 'before','value': '$'},
{'name': currencyDetail.GuyanaDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.KazakhstanTenge,'pos': 'before','value': '?'},
{'name': currencyDetail.Haitiangourde,'pos': 'before','value': 'HTG'},
{'name': currencyDetail.won,'pos': 'before','value': '?'},
{'name': currencyDetail.NetherlandsAntillesGuilder,'pos': 'before','value': 'NAf.'},
{'name': currencyDetail.Honduraslempiras,'pos': 'before','value': 'L'},
{'name': currencyDetail.DjiboutiFranc,'pos': 'before','value': 'Fdj'},
{'name': currencyDetail.KyrgyzstanSom,'pos': 'before','value': 'KGS'},
{'name': currencyDetail.GuineaFranc,'pos': 'before','value': 'FG'},
{'name': currencyDetail.CanadianDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.GhanaianCedi,'pos': 'before','value': 'GHS'},
{'name': currencyDetail.Cambodianriel,'pos': 'before','value': 'Riel'},
{'name': currencyDetail.CzechKoruna,'pos': 'after','value': 'K?'},
{'name': currencyDetail.ZimbabweDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.QatariRiyal,'pos': 'before','value': 'Rial'},
{'name': currencyDetail.CaymanIslandsDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.Comorianfranc,'pos': 'before','value': 'CF'},
{'name': currencyDetail.KuwaitiDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.CroatianKuna,'pos': 'before','value': 'kn'},
{'name': currencyDetail.KenyanShilling,'pos': 'before','value': 'Ksh'},
{'name': currencyDetail.LesothoLoti,'pos': 'before','value': 'LSL'},
{'name': currencyDetail.LaoKip,'pos': 'before','value': '?'},
{'name': currencyDetail.LebanesePound,'pos': 'before','value': 'L£'},
{'name': currencyDetail.Lithuanianlitas,'pos': 'before','value': 'Lt'},
{'name': currencyDetail.LibyanDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.LiberianDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.RwandaFranc,'pos': 'before','value': 'RF'},
{'name': currencyDetail.RomanianLeu,'pos': 'before','value': 'RON'},
{'name': currencyDetail.MalagasyAriary,'pos': 'before','value': 'Ar'},
{'name': currencyDetail.MaldivianRufiyaa,'pos': 'before','value': 'Rf'},
{'name': currencyDetail.MalawiKwacha,'pos': 'before','value': 'MWK'},
{'name': currencyDetail.MalaysianRinggit,'pos': 'before','value': 'RM'},
{'name': currencyDetail.MacedoniawearingDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.MauritiusRupee,'pos': 'before','value': 'MURs'},
{'name': currencyDetail.MauritanianOuguiya,'pos': 'before','value': 'MRO'},
{'name': currencyDetail.MongolianTugrik,'pos': 'before','value': '?'},
{'name': currencyDetail.BangladeshiTaka,'pos': 'before','value': '?'},
{'name': currencyDetail.PeruvianNuevoSol,'pos': 'before','value': 'S/'},
{'name': currencyDetail.MyanmarKyat,'pos': 'before','value': 'K'},
{'name': currencyDetail.MoldovanLeu,'pos': 'before','value': 'MDL'},
{'name': currencyDetail.MoroccanDirham,'pos': 'before','value': 'dh'},
{'name': currencyDetail.MozambiqueMetical,'pos': 'before','value': 'MTn'},
{'name': currencyDetail.MexicanPeso,'pos': 'before','value': '$'},
{'name': currencyDetail.NamibianDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.SouthAfricanRand,'pos': 'before','value': 'R'},
{'name': currencyDetail.SouthSudanesePound,'pos': 'before','value': '£'},
{'name': currencyDetail.NicaraguaCordoba,'pos': 'before','value': 'C$'},
{'name': currencyDetail.NepaleseRupee,'pos': 'before','value': 'Rs'},
{'name': currencyDetail.NigerianNaira,'pos': 'before','value': '?'},
{'name': currencyDetail.NorwegianKrone,'pos': 'after','value': 'kr'},
{'name': currencyDetail.GeorgianLari,'pos': 'before','value': 'GEL'},
{'name': currencyDetail.RenminbiOffshore,'pos': 'before','value': '¥'},
{'name': currencyDetail.SwedishKrona,'pos': 'after','value': 'kr'},
{'name': currencyDetail.SwissFranc,'pos': 'before','value': 'CHF'},
{'name': currencyDetail.SerbianDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.SierraLeone,'pos': 'before','value': 'SLL'},
{'name': currencyDetail.SeychellesRupee,'pos': 'before','value': 'SCR'},
{'name': currencyDetail.SaudiRiyal,'pos': 'before','value': 'Rial'},
{'name': currencyDetail.SaoTomeDobra,'pos': 'before','value': 'Db'},
{'name': currencyDetail.SaintHelenapound,'pos': 'before','value': '£'},
{'name': currencyDetail.SriLankaRupee,'pos': 'before','value': 'Rs'},
{'name': currencyDetail.SwazilandLilangeni,'pos': 'before','value': 'SZL'},
{'name': currencyDetail.SudanesePound,'pos': 'before','value': 'SDG'},
{'name': currencyDetail.Surinamesedollar,'pos': 'before','value': '$'},
{'name': currencyDetail.SolomonIslandsDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.SomaliShilling,'pos': 'before','value': 'SOS'},
{'name': currencyDetail.TajikistanSomoni,'pos': 'before','value': 'Som'},
{'name': currencyDetail.PacificFranc,'pos': 'after','value': 'FCFP'},
{'name': currencyDetail.ThaiBaht,'pos': 'before','value': '?'},
{'name': currencyDetail.TanzanianShilling,'pos': 'before','value': 'TSh'},
{'name': currencyDetail.TonganPaanga,'pos': 'before','value': 'T$'},
{'name': currencyDetail.TrinidadandTobagoDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.TunisianDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.TurkishLira,'pos': 'before','value': '?'},
{'name': currencyDetail.VanuatuVatu,'pos': 'before','value': 'VUV'},
{'name': currencyDetail.GuatemalanQuetzal,'pos': 'before','value': 'Q'},
{'name': currencyDetail.CommissionBolivar,'pos': 'before','value': 'Bs'},
{'name': currencyDetail.BruneiDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.UgandanShilling,'pos': 'before','value': 'UGX'},
{'name': currencyDetail.UkrainianHryvnia,'pos': 'before','value': 'грн.'},
{'name': currencyDetail.UruguayanPeso,'pos': 'before','value': '$'},
{'name': currencyDetail.Uzbekistansom,'pos': 'before','value': 'so?m'},
{'name': currencyDetail.WesternSamoaTala,'pos': 'before','value': 'WST'},
{'name': currencyDetail.SingaporeDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.NT,'pos': 'before','value': 'NT$'},
{'name': currencyDetail.NewZealandDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.HungarianForint,'pos': 'before','value': 'Ft'},
{'name': currencyDetail.SyrianPound,'pos': 'before','value': '£'},
{'name': currencyDetail.JamaicanDollar,'pos': 'before','value': '$'},
{'name': currencyDetail.ArmenianDram,'pos': 'before','value': 'Dram'},
{'name': currencyDetail.YemeniRial,'pos': 'before','value': 'Rial'},
{'name': currencyDetail.IraqiDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.IranianRial,'pos': 'before','value': 'Rial'},
{'name': currencyDetail.NewIsraeliShekel,'pos': 'before','value': '?'},
{'name': currencyDetail.IndianRupee,'pos': 'before','value': '?'},
{'name': currencyDetail.IndonesianRupiah,'pos': 'before','value': 'Rp'},
{'name': currencyDetail.JordanianDinar,'pos': 'before','value': 'din'},
{'name': currencyDetail.VND,'pos': 'after','value': '?'},
{'name': currencyDetail.ZambianKwacha,'pos': 'before','value': 'ZMW'},
{'name': currencyDetail.GibraltarPound,'pos': 'before','value': '£'},
{'name': currencyDetail.ChileanPeso,'pos': 'before','value': '$'},
{'name': currencyDetail.CFAFrancBEAC,'pos': 'before','value': 'FCFA'}
];
this.dateFmtList = locale().dateFmtList;
this.numFmtList = [
{
"name": "1235",
"value": "0"
},
{
"name": "1234.56",
"value": "0.00"
},
{
"name": "1,235",
"value": "#,##0"
},
{
"name": "1,234.56",
"value": "#,##0.00"
},
{
"name": "1,235",
"value": "#,##0_);(#,##0)"
},
{
"name": "1,235",
"value": "#,##0_);[Red](#,##0)"
},
{
"name": "1,234.56",
"value": "#,##0.00_);(#,##0.00)"
},
{
"name": "1,234.56",
"value": "#,##0.00_);[Red](#,##0.00)"
},
{
"name": "$1,235",
"value": "$#,##0_);($#,##0)"
},
{
"name": "$1,235",
"value": "$#,##0_);[Red]($#,##0)"
},
{
"name": "$1,234.56",
"value": "$#,##0.00_);($#,##0.00)"
},
{
"name": "$1,234.56",
"value": "$#,##0.00_);[Red]($#,##0.00)"
},
{
"name": "1234.56",
"value": "@"
},
{
"name": "123456%",
"value": "0%"
},
{
"name": "123456.00%",
"value": "0.00%"
},
{
"name": "1.23E+03",
"value": "0.00E+00"
},
{
"name": "1.2E+3",
"value": "##0.0E+0"
},
{
"name": "1234 5/9",
"value": "# ?/?"
},
{
"name": "1234 14/25",
"value": "# ??/??"
},
{
"name": "$ 1,235",
"value": '_($* #,##0_);_(...($* "-"_);_(@_)'
},
{
"name": "1,235",
"value": '_(* #,##0_);_(*..._(* "-"_);_(@_)'
},
{
"name": "$ 1,234.56",
// "value": '_($* #,##0.00_)...* "-"??_);_(@_)'
"value": '_($* #,##0.00_);_(...($* "-"_);_(@_)'
},
{
"name": "1,234.56",
"value": '_(* #,##0.00_);...* "-"??_);_(@_)'
},
]
$("#luckysheet-modal-dialog-mask").show(); $("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-moreFormat-dialog").remove(); $("#luckysheet-moreFormat-dialog").remove();
let title = "", content = ''; let title = "", content = '';
if(type == "morecurrency"){ //货币 if(type == "morecurrency"){ //货币
title = "货币格式"; title = locale_format.titleCurrency;
let listHtml = ''; let listHtml = '';
@ -819,14 +1082,14 @@ const luckysheetMoreFormat = {
content = '<div class="box" id="morecurrency">'+ content = '<div class="box" id="morecurrency">'+
'<div class="decimal">'+ '<div class="decimal">'+
'<label>小数位数:</label>'+ '<label>'+ locale_format.decimalPlaces +':</label>'+
'<input type="number" class="formulaInputFocus" value="2" min="0" max="9"/>'+ '<input type="number" class="formulaInputFocus" value="2" min="0" max="9"/>'+
'</div>'+ '</div>'+
'<div class="listbox">'+ listHtml +'</div>'+ '<div class="listbox">'+ listHtml +'</div>'+
'</div>'; '</div>';
} }
else if(type == "moredatetime"){ //日期时间 else if(type == "moredatetime"){ //日期时间
title = "日期与时间格式"; title = locale_format.titleDateTime;
let listHtml = ''; let listHtml = '';
@ -845,7 +1108,7 @@ const luckysheetMoreFormat = {
'</div>'; '</div>';
} }
else if(type == "moredigit"){ //数字 else if(type == "moredigit"){ //数字
title = "数字格式"; title = locale_format.titleNumber;
let listHtml = ''; let listHtml = '';
@ -869,7 +1132,7 @@ const luckysheetMoreFormat = {
"addclass": "luckysheet-moreFormat-dialog", "addclass": "luckysheet-moreFormat-dialog",
"title": title, "title": title,
"content": content, "content": content,
"botton": '<button id="luckysheet-moreFormat-dialog-confirm" class="btn btn-primary">确定</button><button class="btn btn-default luckysheet-model-close-btn">取消</button>', "botton": '<button id="luckysheet-moreFormat-dialog-confirm" class="btn btn-primary">'+ locale_button.confirm +'</button><button class="btn btn-default luckysheet-model-close-btn">'+ locale_button.cancel +'</button>',
"style": "z-index:100003" "style": "z-index:100003"
})); }));
let $t = $("#luckysheet-moreFormat-dialog").find(".luckysheet-modal-dialog-content").css("min-width", 400).end(), let $t = $("#luckysheet-moreFormat-dialog").find(".luckysheet-modal-dialog-content").css("min-width", 400).end(),

2
src/index.html

@ -31,7 +31,7 @@
luckysheet.create({ luckysheet.create({
container: 'luckysheet', container: 'luckysheet',
lang: 'zh', lang: 'en',
plugins: ['chart'], plugins: ['chart'],
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable] data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable]
}) })

259
src/locale/en.js

@ -45,12 +45,24 @@ export default {
chart: 'Chart', chart: 'Chart',
screenshot: 'Screenshot', screenshot: 'Screenshot',
splitColumn: 'Split column', splitColumn: 'Split column',
clearText:"Clear color",
noColorSelectedText:"No color is selected",
}, },
alternatingColors:{ alternatingColors:{
applyRange: 'Apply to range', applyRange: 'Apply to range',
selectRange: 'Select a data range', selectRange: 'Select a data range',
header: 'Header', header: 'Header',
footer: 'Footer', footer: 'Footer',
errorInfo:"Cannot perform this operation on multiple selection areas, please select a single area and try again",
textTitle:"Format style",
custom:"CUSTOM",
close:"close",
selectionTextColor:"Click to select text color",
selectionCellColor:"Click to select cell color",
removeColor:"Remove alternating colors",
colorShow:"color",
}, },
button: { button: {
confirm: 'OK', confirm: 'OK',
@ -61,30 +73,245 @@ export default {
paintFormatEnd: 'ESC key to exit', paintFormatEnd: 'ESC key to exit',
}, },
format:{ 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', moreCurrency: 'More currency formats',
moreDateTime: 'More date and time formats', moreDateTime: 'More date and time formats',
moreNumber: 'More number formats', moreNumber: 'More number formats',
titleCurrency: 'Currency formats',
decimalPlaces: 'Decimal places',
titleDateTime: 'Date and time formats',
titleNumber: 'Number formats'
}, },
info:{ info:{
detailUpdate: 'New opened', detailUpdate: 'New opened',
detailSave: 'Local cache restored', detailSave: 'Local cache restored',
row: 'row', row: 'row',
column: 'column' column: 'column'
} },
currencyDetail:{
RMB:'RMB',
USdollar:'US dollar',
EUR:'EUR',
GBP:'GBP',
HK:'HK',
JPY:'JPY',
AlbanianLek:'Albanian Lek',
AlgerianDinar:'Algerian Dinar',
Afghani:'Afghani',
ArgentinePeso:'Argentine Peso',
UnitedArabEmiratesDirham:'United Arab Emirates Dirham',
ArubanFlorin:'Aruban Florin',
OmaniRial:'Omani Rial',
Azerbaijanimanat:'Azerbaijani manat',
EgyptianPound:'Egyptian Pound',
EthiopianBirr:'Ethiopian Birr',
AngolaKwanza:'Angola Kwanza',
AustralianDollar:'Australian Dollar',
Patacas:'Patacas',
BarbadosDollar:'Barbados Dollar',
PapuaNewGuineaKina:'Papua New Guinea Kina',
BahamianDollar:'Bahamian Dollar',
PakistanRupee:'Pakistan Rupee',
ParaguayanGuarani:'Paraguayan Guarani',
BahrainiDinar:'Bahraini Dinar',
PanamanianBalboa:'Panamanian Balboa',
Brazilianreal:'Brazilian real',
Belarusianruble:'Belarusian ruble',
BermudianDollar:'Bermudian Dollar',
BulgarianLev:'Bulgarian Lev',
IcelandKrona:'Iceland Krona',
BosniaHerzegovinaConvertibleMark:'Bosnia-Herzegovina Convertible Mark',
PolishZloty:'Polish Zloty',
Boliviano:'Boliviano',
BelizeDollar:'Belize Dollar',
BotswanaPula:'Botswana Pula',
NotDannuzhamu:'Not Dannuzhamu',
BurundiFranc:'Burundi Franc',
NorthKoreanWon:'North Korean Won',
DanishKrone:'Danish Krone',
EastCaribbeanDollar:'East Caribbean Dollar',
DominicaPeso:'Dominica Peso',
RussianRuble:'Russian Ruble',
EritreanNakfa:'Eritrean Nakfa',
CFAfranc:'CFA franc',
PhilippinePeso:'Philippine Peso',
FijiDollar:'Fiji Dollar',
CapeVerdeEscudo:'Cape Verde Escudo',
FalklandIslandsPound:'Falkland Islands Pound',
GambianDalasi:'Gambian Dalasi',
Congolesefranc:'Congolese franc',
ColombianPeso:'Colombian Peso',
CostaRicanColon:'Costa Rican Colon',
CubanPeso:'Cuban Peso',
Cubanconvertiblepeso:'Cuban convertible peso',
GuyanaDollar:'Guyana Dollar',
KazakhstanTenge:'Kazakhstan Tenge',
Haitiangourde:'Haitian gourde',
won:'won',
NetherlandsAntillesGuilder:'Netherlands Antilles Guilder',
Honduraslempiras:'Honduras lempiras',
DjiboutiFranc:'Djibouti Franc',
KyrgyzstanSom:'Kyrgyzstan Som',
GuineaFranc:'Guinea Franc',
CanadianDollar:'Canadian Dollar',
GhanaianCedi:'Ghanaian Cedi',
Cambodianriel:'Cambodian riel',
CzechKoruna:'Czech Koruna',
ZimbabweDollar:'Zimbabwe Dollar',
QatariRiyal:'Qatari Riyal',
CaymanIslandsDollar:'Cayman Islands Dollar',
Comorianfranc:'Comorian franc',
KuwaitiDinar:'Kuwaiti Dinar',
CroatianKuna:'Croatian Kuna',
KenyanShilling:'Kenyan Shilling',
LesothoLoti:'Lesotho Loti',
LaoKip:'Lao Kip',
LebanesePound:'Lebanese Pound',
Lithuanianlitas:'Lithuanian litas',
LibyanDinar:'Libyan Dinar',
LiberianDollar:'Liberian Dollar',
RwandaFranc:'Rwanda Franc',
RomanianLeu:'Romanian Leu',
MalagasyAriary:'Malagasy Ariary',
MaldivianRufiyaa:'Maldivian Rufiyaa',
MalawiKwacha:'Malawi Kwacha',
MalaysianRinggit:'Malaysian Ringgit',
MacedoniawearingDinar:'Macedonia wearing Dinar',
MauritiusRupee:'Mauritius Rupee',
MauritanianOuguiya:'Mauritanian Ouguiya',
MongolianTugrik:'Mongolian Tugrik',
BangladeshiTaka:'Bangladeshi Taka',
PeruvianNuevoSol:'Peruvian Nuevo Sol',
MyanmarKyat:'Myanmar Kyat',
MoldovanLeu:'Moldovan Leu',
MoroccanDirham:'Moroccan Dirham',
MozambiqueMetical:'Mozambique Metical',
MexicanPeso:'Mexican Peso',
NamibianDollar:'Namibian Dollar',
SouthAfricanRand:'South African Rand',
SouthSudanesePound:'South Sudanese Pound',
NicaraguaCordoba:'Nicaragua Cordoba',
NepaleseRupee:'Nepalese Rupee',
NigerianNaira:'Nigerian Naira',
NorwegianKrone:'Norwegian Krone',
GeorgianLari:'Georgian Lari',
RMBOffshore:'RMB (Offshore)',
SwedishKrona:'Swedish Krona',
SwissFranc:'Swiss Franc',
SerbianDinar:'Serbian Dinar',
SierraLeone:'Sierra Leone',
SeychellesRupee:'Seychelles Rupee',
SaudiRiyal:'Saudi Riyal',
SaoTomeDobra:'Sao Tome Dobra',
SaintHelenapound:'Saint Helena pound',
SriLankaRupee:'Sri Lanka Rupee',
SwazilandLilangeni:'Swaziland Lilangeni',
SudanesePound:'Sudanese Pound',
Surinamesedollar:'Surinamese dollar',
SolomonIslandsDollar:'Solomon Islands Dollar',
SomaliShilling:'Somali Shilling',
TajikistanSomoni:'Tajikistan Somoni',
PacificFranc:'Pacific Franc',
ThaiBaht:'Thai Baht',
TanzanianShilling:'Tanzanian Shilling',
TonganPaanga:"Tongan Pa'anga",
TrinidadandTobagoDollar:'Trinidad and Tobago Dollar',
TunisianDinar:'Tunisian Dinar',
TurkishLira:'Turkish Lira',
VanuatuVatu:'Vanuatu Vatu',
GuatemalanQuetzal:'Guatemalan Quetzal',
CommissionBolivar:'Commission Bolivar',
BruneiDollar:'Brunei Dollar',
UgandanShilling:'Ugandan Shilling',
UkrainianHryvnia:'Ukrainian Hryvnia',
UruguayanPeso:'Uruguayan Peso',
Uzbekistansom:'Uzbekistan som',
WesternSamoaTala:'Western Samoa Tala',
SingaporeDollar:'Singapore Dollar',
NT:'NT',
NewZealandDollar:'New Zealand Dollar',
HungarianForint:'Hungarian Forint',
SyrianPound:'Syrian Pound',
JamaicanDollar:'Jamaican Dollar',
ArmenianDram:'Armenian Dram',
YemeniRial:'Yemeni Rial',
IraqiDinar:'Iraqi Dinar',
IranianRial:'Iranian Rial',
NewIsraeliShekel:'New Israeli Shekel',
IndianRupee:'Indian Rupee',
IndonesianRupiah:'Indonesian Rupiah',
JordanianDinar:'Jordanian Dinar',
VND:'VND',
ZambianKwacha:'Zambian Kwacha',
GibraltarPound:'Gibraltar Pound',
ChileanPeso:'Chilean Peso',
CFAFrancBEAC:'CFA Franc BEAC'
},
defaultFmt:[
{ "text": 'Automatic', "value": "General", "example": "" },
{ "text": 'Plain text', "value": "@", "example": "" },
{ "text": "", "value": "split", "example": "" },
{ "text": 'Number', "value": "##0.00", "example": "1000.12" },
{ "text": 'Percent', "value": "#0.00%", "example": "12.21%" },
{ "text": 'Scientific', "value": "0.00E+00", "example": "1.01E+5" },
{ "text": "", "value": "split", "example": "" },
{ "text": 'Accounting', "value": "¥(0.00)", "example": "¥(1200.09)" },
{ "text": 'Currency', "value": "¥0.00", "example": "¥1200.09" },
{ "text": "", "value": "split", "example": "" },
{ "text": 'Date', "value": "yyyy-MM-dd", "example": "2017-11-29" },
{ "text": 'Time', "value": "hh:mm AM/PM", "example": "3:00 PM" },
{ "text": 'Time 24H', "value": "hh:mm", "example": "15:00" },
{ "text": 'Date time', "value": "yyyy-MM-dd hh:mm AM/PM", "example": "2017-11-29 3:00 PM" },
{ "text": 'Date time 24 H', "value": "yyyy-MM-dd hh:mm", "example": "2017-11-29 15:00" },
{ "text": "", "value": "split", "example": "" },
{ "text": 'Custom formats', "value": "fmtOtherSelf", "example": "more" }
],
dateFmtList:[
{
"name": "1930-08-05",
"value": "yyyy-MM-dd"
},
{
"name": "1930/8/5",
"value": "yyyy/MM/dd"
},
{
"name": "08-05",
"value": "MM-dd"
},
{
"name": "8-5",
"value": "M-d"
},
{
"name": "13:30:30",
"value": "h:mm:ss"
},
{
"name": "13:30",
"value": "h:mm"
},
{
"name": "PM 01:30",
"value": 'AM/PM hh:mm'
},
{
"name": "PM 1:30",
"value": 'AM/PM h:mm'
},
{
"name": "PM 1:30:30",
"value": 'AM/PM h:mm:ss'
},
{
"name": "08-05 PM 01:30",
"value": "MM-dd AM/PM hh:mm"
}
],
fontFamily:{
MicrosoftYaHei:"YaHei",
},
fontarray: ["Times New Roman","Arial","Tahoma","Verdana"],
fontjson: {"arial":1,"times new roman":0,"tahoma":2,"verdana":3}
}; };

284
src/locale/zh.js

@ -44,12 +44,26 @@ export default {
chart: '图表', chart: '图表',
screenshot: '截图', screenshot: '截图',
splitColumn: '分列', splitColumn: '分列',
clearText:"清除颜色选择",
noColorSelectedText:"没有颜色被选择",
}, },
alternatingColors:{ alternatingColors:{
applyRange: '应用范围', applyRange: '应用范围',
selectRange: '选择应用范围', selectRange: '选择应用范围',
header: '页眉', header: '页眉',
footer: '页脚', footer: '页脚',
errorInfo:"不能对多重选择区域执行此操作,请选择单个区域,然后再试",
textTitle:"格式样式",
custom:"自定义",
close:"关闭",
selectionTextColor:"点击选择文本颜色",
selectionCellColor:"点击选择单元格颜色",
removeColor:"移除交替颜色",
colorShow:"颜色",
}, },
button: { button: {
confirm: '确定', confirm: '确定',
@ -60,29 +74,265 @@ export default {
paintFormatEnd: 'ESC键退出', paintFormatEnd: 'ESC键退出',
}, },
format: { format: {
auto: '自动',
text: '纯文本',
number: '数字',
percent: '百分比',
scientific: '科学计数',
accounting: '会计',
tenThousand: '万元',
currency: '货币',
tenThousandDecimal: '万元2位小数',
date: '日期',
time: '时间',
time24H: '时间24H',
dateTime: '日期时间',
dateTime24H: '日期时间24H',
customFormats: '自定义格式',
moreCurrency: '更多货币格式', moreCurrency: '更多货币格式',
moreDateTime: '更多日期与时间格式', moreDateTime: '更多日期与时间格式',
moreNumber: '更多数字格式' moreNumber: '更多数字格式',
titleCurrency: '货币格式',
decimalPlaces: '小数位数',
titleDateTime: '日期与时间格式',
titleNumber: '数字格式'
}, },
info: { info: {
detailUpdate: '新打开', detailUpdate: '新打开',
detailSave: '已恢复本地缓存', detailSave: '已恢复本地缓存',
row: '行', row: '行',
column: '列' column: '列'
} },
currencyDetail:{
RMB:'人民币',
USdollar:'美元',
EUR:'欧元',
GBP:'英镑',
HK:'港元',
JPY:'日元',
AlbanianLek:'阿尔巴尼亚列克',
AlgerianDinar:'阿尔及利亚第纳尔',
Afghani:'阿富汗尼',
ArgentinePeso:'阿根廷比索',
UnitedArabEmiratesDirham:'阿拉伯联合酋长国迪拉姆',
ArubanFlorin:'阿鲁巴弗罗林',
OmaniRial:'阿曼里亚尔',
Azerbaijanimanat:'阿塞拜疆马纳特',
EgyptianPound:'埃及镑',
EthiopianBirr:'埃塞俄比亚比尔',
AngolaKwanza:'安哥拉宽扎',
AustralianDollar:'澳大利亚元',
Patacas:'澳门元',
BarbadosDollar:'巴巴多斯元',
PapuaNewGuineaKina:'巴布亚新几内亚基那',
BahamianDollar:'巴哈马元',
PakistanRupee:'巴基斯坦卢比',
ParaguayanGuarani:'巴拉圭瓜拉尼',
BahrainiDinar:'巴林第纳尔',
PanamanianBalboa:'巴拿马巴波亚',
Brazilianreal:'巴西里亚伊',
Belarusianruble:'白俄罗斯卢布',
BermudianDollar:'百慕大元',
BulgarianLev:'保加利亚列弗',
IcelandKrona:'冰岛克朗',
BosniaHerzegovinaConvertibleMark:'波黑可兑换马克',
PolishZloty:'波兰兹罗提',
Boliviano:'玻利维亚诺',
BelizeDollar:'伯利兹元',
BotswanaPula:'博茨瓦纳普拉',
NotDannuzhamu:'不丹努扎姆',
BurundiFranc:'布隆迪法郎',
NorthKoreanWon:'朝鲜圆',
DanishKrone:'丹麦克朗',
EastCaribbeanDollar:'东加勒比元',
DominicaPeso:'多米尼加比索',
RussianRuble:'俄国卢布',
EritreanNakfa:'厄立特里亚纳克法',
CFAfranc:'非洲金融共同体法郎',
PhilippinePeso:'菲律宾比索',
FijiDollar:'斐济元',
CapeVerdeEscudo:'佛得角埃斯库多',
FalklandIslandsPound:'福克兰群岛镑',
GambianDalasi:'冈比亚达拉西',
Congolesefranc:'刚果法郎',
ColombianPeso:'哥伦比亚比索',
CostaRicanColon:'哥斯达黎加科朗',
CubanPeso:'古巴比索',
Cubanconvertiblepeso:'古巴可兑换比索',
GuyanaDollar:'圭亚那元',
KazakhstanTenge:'哈萨克斯坦坚戈',
Haitiangourde:'海地古德',
won:'韩元',
NetherlandsAntillesGuilder:'荷属安的列斯盾',
Honduraslempiras:'洪都拉斯拉伦皮拉',
DjiboutiFranc:'吉布提法郎',
KyrgyzstanSom:'吉尔吉斯斯坦索姆',
GuineaFranc:'几内亚法郎',
CanadianDollar:'加拿大元',
GhanaianCedi:'加纳塞地',
Cambodianriel:'柬埔寨瑞尔',
CzechKoruna:'捷克克朗',
ZimbabweDollar:'津巴布韦元',
QatariRiyal:'卡塔尔里亚尔',
CaymanIslandsDollar:'开曼群岛元',
Comorianfranc:'科摩罗法郎',
KuwaitiDinar:'科威特第纳尔',
CroatianKuna:'克罗地亚库纳',
KenyanShilling:'肯尼亚先令',
LesothoLoti:'莱索托洛蒂',
LaoKip:'老挝基普',
LebanesePound:'黎巴嫩镑',
Lithuanianlitas:'立陶宛立特',
LibyanDinar:'利比亚第纳尔',
LiberianDollar:'利比亚元',
RwandaFranc:'卢旺达法郎',
RomanianLeu:'罗马尼亚列伊',
MalagasyAriary:'马达加斯加阿里亚里',
MaldivianRufiyaa:'马尔代夫拉菲亚',
MalawiKwacha:'马拉维克瓦查',
MalaysianRinggit:'马来西亚林吉特',
MacedoniawearingDinar:'马其顿戴第纳尔',
MauritiusRupee:'毛里求斯卢比',
MauritanianOuguiya:'毛里塔尼亚乌吉亚',
MongolianTugrik:'蒙古图格里克',
BangladeshiTaka:'孟加拉塔卡',
PeruvianNuevoSol:'秘鲁新索尔',
MyanmarKyat:'缅甸开亚特',
MoldovanLeu:'摩尔多瓦列伊',
MoroccanDirham:'摩洛哥迪拉姆',
MozambiqueMetical:'莫桑比克梅蒂卡尔',
MexicanPeso:'墨西哥比索',
NamibianDollar:'纳米比亚元',
SouthAfricanRand:'南非兰特',
SouthSudanesePound:'南苏丹镑',
NicaraguaCordoba:'尼加拉瓜科多巴',
NepaleseRupee:'尼泊尔卢比',
NigerianNaira:'尼日利亚奈拉',
NorwegianKrone:'挪威克朗',
GeorgianLari:'乔治亚拉瑞',
RMBOffshore:'人民币(离岸)',
SwedishKrona:'瑞典克朗',
SwissFranc:'瑞士法郎',
SerbianDinar:'塞尔维亚第纳尔',
SierraLeone:'塞拉利昂利昂',
SeychellesRupee:'塞舌尔卢比',
SaudiRiyal:'沙特里亚尔',
SaoTomeDobra:'圣多美多布拉',
SaintHelenapound:'圣赫勒拿群岛磅',
SriLankaRupee:'斯里兰卡卢比',
SwazilandLilangeni:'斯威士兰里兰吉尼',
SudanesePound:'苏丹镑',
Surinamesedollar:'苏里南元',
SolomonIslandsDollar:'所罗门群岛元',
SomaliShilling:'索马里先令',
TajikistanSomoni:'塔吉克斯坦索莫尼',
PacificFranc:'太平洋法郎',
ThaiBaht:'泰国铢',
TanzanianShilling:'坦桑尼亚先令',
TonganPaanga:'汤加潘加',
TrinidadandTobagoDollar:'特立尼达和多巴哥元',
TunisianDinar:'突尼斯第纳尔',
TurkishLira:'土耳其里拉',
VanuatuVatu:'瓦努阿图瓦图',
GuatemalanQuetzal:'危地马拉格查尔',
CommissionBolivar:'委内瑞拉博利瓦',
BruneiDollar:'文莱元',
UgandanShilling:'乌干达先令',
UkrainianHryvnia:'乌克兰格里夫尼亚',
UruguayanPeso:'乌拉圭比索',
Uzbekistansom:'乌兹别克斯坦苏姆',
WesternSamoaTala:'西萨摩亚塔拉',
SingaporeDollar:'新加坡元',
NT:'新台币',
NewZealandDollar:'新西兰元',
HungarianForint:'匈牙利福林',
SyrianPound:'叙利亚镑',
JamaicanDollar:'牙买加元',
ArmenianDram:'亚美尼亚德拉姆',
YemeniRial:'也门里亚尔',
IraqiDinar:'伊拉克第纳尔',
IranianRial:'伊朗里亚尔',
NewIsraeliShekel:'以色列新谢克尔',
IndianRupee:'印度卢比',
IndonesianRupiah:'印度尼西亚卢比',
JordanianDinar:'约旦第纳尔',
VND:'越南盾',
ZambianKwacha:'赞比亚克瓦查',
GibraltarPound:'直布罗陀镑',
ChileanPeso:'智利比索',
CFAFrancBEAC:'中非金融合作法郎',
},
defaultFmt:[
{ "text": '自动', "value": "General", "example": "" },
{ "text": '纯文本', "value": "@", "example": "" },
{ "text": "", "value": "split", "example": "" },
{ "text": '数字', "value": "##0.00", "example": "1000.12" },
{ "text": '百分比', "value": "#0.00%", "example": "12.21%" },
{ "text": '科学计数', "value": "0.00E+00", "example": "1.01E+5" },
{ "text": "", "value": "split", "example": "" },
{ "text": '会计', "value": "¥(0.00)", "example": "¥(1200.09)" },
//{ "text": "财务", "value": "(#.####)", "example": "(1200.09)" },
{ "text": '万元', "value": "w", "example": "1亿2000万2500" },
{ "text": '货币', "value": "¥0.00", "example": "¥1200.09" },
//{ "text": "货币整数", "value": "¥####", "example": "¥1200" },
{ "text": '万元2位小数', "value": "w0.00", "example": "2万2500.55" },
{ "text": "", "value": "split", "example": "" },
{ "text": '日期', "value": "yyyy-MM-dd", "example": "2017-11-29" },
{ "text": '时间', "value": "hh:mm AM/PM", "example": "3:00 PM" },
{ "text": '时间24H', "value": "hh:mm", "example": "15:00" },
{ "text": '日期时间', "value": "yyyy-MM-dd hh:mm AM/PM", "example": "2017-11-29 3:00 PM" },
{ "text": '日期时间24H', "value": "yyyy-MM-dd hh:mm", "example": "2017-11-29 15:00" },
{ "text": "", "value": "split", "example": "" },
{ "text": '自定义格式', "value": "fmtOtherSelf", "example": "more" }
],
dateFmtList:[
{
"name": "1930-08-05",
"value": "yyyy-MM-dd"
},
{
"name": "1930/8/5",
"value": "yyyy/MM/dd"
},
{
"name": "1930年8月5日",
"value": 'yyyy"年"M"月"d"日"'
},
{
"name": "08-05",
"value": "MM-dd"
},
{
"name": "8-5",
"value": "M-d"
},
{
"name": "8月5日",
"value": 'M"月"d"日"'
},
{
"name": "13:30:30",
"value": "h:mm:ss"
},
{
"name": "13:30",
"value": "h:mm"
},
{
"name": "下午01:30",
"value": 'AM/PM hh:mm'
},
{
"name": "下午1:30",
"value": 'AM/PM h:mm'
},
{
"name": "下午1:30:30",
"value": 'AM/PM h:mm:ss'
},
{
"name": "08-05 下午01:30",
"value": "MM-dd AM/PM hh:mm"
},
// {
// "name": "1930年8月5日星期二",
// "value": ''
// },
// {
// "name": "1930年8月5日星期二 下午1:30:30",
// "value": ''
// },
],
fontFamily:{
MicrosoftYaHei:"Microsoft YaHei",
},
fontarray: ["微软雅黑","宋体","黑体","楷体","仿宋","新宋体","华文新魏","华文行楷","华文隶书","Arial","Times New Roman","Tahoma","Verdana"],
fontjson: {"微软雅黑":0,"microsoft yahei":0,"宋体":1,"simsun":1,"黑体":2,"simhei":2,"楷体":3,"kaiti":3,"仿宋":4,"fangsong":4,"新宋体":5,"nsimsun":5,"华文新魏":6,"stxinwei":6,"华文行楷":7,"stxingkai":7,"华文隶书":8,"stliti":8,"arial":9,"times new roman":10,"tahoma":11,"verdana":12}
}; };

13
src/utils/util.js

@ -3,6 +3,7 @@ import menuButton from '../controllers/menuButton';
import { isdatatype, isdatatypemulti } from '../global/datecontroll'; import { isdatatype, isdatatypemulti } from '../global/datecontroll';
import { hasChinaword } from '../global/validate'; import { hasChinaword } from '../global/validate';
import Store from '../store'; import Store from '../store';
import locale from '../locale/locale';
/** /**
* Common tool methods * Common tool methods
@ -292,6 +293,7 @@ function ArrayUnique(dataArr) {
//获取字体配置 //获取字体配置
function luckysheetfontformat(format) { function luckysheetfontformat(format) {
let fontarray = locale().fontarray;
if (getObjType(format) == "object") { if (getObjType(format) == "object") {
let font = ""; let font = "";
@ -323,21 +325,22 @@ function luckysheetfontformat(format) {
} }
if (!format.ff) { if (!format.ff) {
font += '微软雅黑, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';
font += fontarray[0] + ', "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';
} }
else { else {
let fontarray = menuButton.fontarray;
let fontfamily = null; let fontfamily = null;
let fontjson = locale().fontjson;
if (isdatatypemulti(format.ff)["num"]) { if (isdatatypemulti(format.ff)["num"]) {
fontfamily = fontarray[parseInt(format.ff)]; fontfamily = fontarray[parseInt(format.ff)];
} }
else { else {
fontfamily = fontarray[menuButton.fontjson[format.ff]];
fontfamily = fontarray[fontjson[format.ff]];
} }
if (fontfamily == null) { if (fontfamily == null) {
fontfamily = "微软雅黑"; fontfamily = fontarray[0];
} }
font += fontfamily + ', "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif'; font += fontfamily + ', "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';

Loading…
Cancel
Save