지역화를 지원하려면 Spread 링크 아래의 문서 헤더 섹션에 적절한 js 파일 링크를 추가해야 합니다. 예:
그런 후 다음 방법 중 하나를 선택하여 지역화를 지원할 수 있습니다.
문화권 메타
다음 메타 태그를 사용하여 문화권을 설정할 수 있습니다.
코드로 변경
GC.Spread.Common.CultureManager.culture 메서드를 사용하여 다음과 같이 문화권을 변경할 수 있습니다:
<template>
<div class="sample-tutorial">
<gc-spread-sheets class="sample-spreadsheets" @workbookInitialized="initSpread">
<gc-worksheet>
</gc-worksheet>
</gc-spread-sheets>
<div class="options-container">
<div class="option-row">
<label>Culture:</label>
<select id="cultureName" @change="changeCultureName">
<option value="en-us" selected>English</option>
<option value="zh-cn">Chinese</option>
<option value="ja-jp">Japanese</option>
<option value="ko-kr">Korean</option>
</select>
</div>
<div class="option-row">
<ul style="margin: 0;padding-left: 20px;">
<li>Perform any of the below actions to view the results:</li>
<div>- Click a filter dropdown in the column header</div>
<div>- Resize a column or row header</div>
<div>- Use the scrollbar to scroll the contents</div>
<li>To view localized formula descriptions:</li>
<div>- Double click cell B11 or B12</div>
<div>- Click to edit the formula to view the updated descriptions</div>
</ul>
</div>
</div>
</div>
</template>
<script setup>
import '@mescius/spread-sheets-vue';
import { ref } from "vue";
import GC from "@mescius/spread-sheets";
import '@mescius/spread-sheets-resources-ja';
import '@mescius/spread-sheets-resources-ko';
import '@mescius/spread-sheets-resources-zh';
GC.Spread.Common.CultureManager.culture("ko-kr");
const spreadRef = ref(null);
const initSpread = (spread) => {
spreadRef.value = spread;
spread.suspendPaint();
let spreadNS = GC.Spread.Sheets;
spread.options.showResizeTip = spreadNS.ShowResizeTip.both;
spread.options.showScrollTip = spreadNS.ShowScrollTip.both;
let sheet = spread.getActiveSheet();
for (let r = 0; r < 10; r++) {
for (let c = 0; c < 5; c++) {
sheet.setValue(r, c, r + c);
}
}
sheet.rowFilter(new spreadNS.Filter.HideRowFilter(new spreadNS.Range(0, 0, 10, 5)));
sheet.setValue(10, 0, "SUM:");
sheet.setFormula(10, 1, "SUM(A1:E10)");
sheet.setValue(11, 0, "PIESPARKLINE:");
sheet.setFormula(11, 1, 'PIESPARKLINE(A1:E10,"yellow", "green")');
sheet.setRowHeight(11, 100);
sheet.setColumnWidth(0, 120);
sheet.setColumnWidth(1, 100);
spread.resumePaint();
GC.Spread.Common.CultureManager.culture("en-us");
}
const changeCultureName = (e) => {
GC.Spread.Common.CultureManager.culture(e.target.value);
}
</script>
<style scoped>
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
.sample-spreadsheets {
width: calc(100% - 280px);
height: 100%;
overflow: hidden;
float: left;
}
.options-container {
float: right;
width: 280px;
padding: 12px;
height: 100%;
box-sizing: border-box;
background: #fbfbfb;
overflow: auto;
}
.option-row {
font-size: 14px;
padding: 5px;
margin-top: 10px;
}
label {
display: block;
margin-bottom: 6px;
}
input {
padding: 4px 6px;
}
input[type=button] {
margin-top: 6px;
display: block;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#app {
height: 100%;
}
</style>
<!DOCTYPE html>
<html style="height:100%;font-size:14px;">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>SpreadJS VUE</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css"
href="$DEMOROOT$/ko/vue3/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<script src="$DEMOROOT$/ko/vue3/node_modules/systemjs/dist/system.src.js"></script>
<script src="./systemjs.config.js"></script>
<script src="./compiler.js" type="module"></script>
<script>
var System = SystemJS;
System.import("./src/app.js");
System.import('$DEMOROOT$/ko/lib/vue3/license.js');
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>
(function (global) {
SystemJS.config({
transpiler: 'plugin-babel',
babelOptions: {
es2015: true
},
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
packageConfigPaths: [
'./node_modules/*/package.json',
"./node_modules/@mescius/*/package.json",
"./node_modules/@babel/*/package.json",
"./node_modules/@vue/*/package.json"
],
map: {
'vue': "npm:vue/dist/vue.esm-browser.js",
'tiny-emitter': 'npm:tiny-emitter/index.js',
'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js',
"systemjs-babel-build": "npm:systemjs-plugin-babel/systemjs-babel-browser.js",
'@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js',
'@mescius/spread-sheets-resources-ja': 'npm:@mescius/spread-sheets-resources-ja/index.js',
'@mescius/spread-sheets-resources-ko': 'npm:@mescius/spread-sheets-resources-ko/index.js',
'@mescius/spread-sheets-resources-zh': 'npm:@mescius/spread-sheets-resources-zh/index.js',
'@mescius/spread-sheets-vue': 'npm:@mescius/spread-sheets-vue/index.js'
},
meta: {
'*.css': { loader: 'systemjs-plugin-css' },
'*.vue': { loader: "../plugin-vue/index.js" }
}
});
})(this);