浅试 i18n

This commit is contained in:
shikong 2024-02-19 17:22:20 +08:00
parent 787db345cd
commit b0fa41e74a
3 changed files with 15 additions and 5 deletions

View File

@ -44,7 +44,7 @@ const chartOptions = {
maxHeight: 300
};
const {locale} = useI18n()
const {t, locale} = useI18n()
const editorRef = ref()
@ -108,7 +108,7 @@ const ctx = reactive({
function openFile(){
OpenFileDialog({
title: "打开 markdown 文件",
title: `${t("general.open")} markdown ${t("general.file")}`,
filters: [
{
displayName: "Markdown",
@ -130,7 +130,7 @@ function openFile(){
function saveFile(){
SaveFileDialog({
title: "保存 markdown",
title: `${t("general.save")} markdown`,
filters: [
{
displayName: "Markdown",
@ -162,8 +162,8 @@ function saveFile(){
</script>
<template>
<el-button type="primary" @click="openFile">打开</el-button>
<el-button type="success" @click="saveFile">保存</el-button>
<el-button type="primary" @click="openFile">{{ t("general.open") }}</el-button>
<el-button type="success" @click="saveFile">{{ t("general.save")}}</el-button>
<div ref="editorRef" class="overscroll-none"/>
</template>

View File

@ -28,5 +28,10 @@
"global": {
"not-supported": "Because it is a beta version, it can't be done for the time being, it will be completed later.",
"click-link": "The currently clicked link is: "
},
"general": {
"open": "open",
"save": "save",
"file": "file"
}
}

View File

@ -28,5 +28,10 @@
"global": {
"not-supported": "由于是测试版,所以暂时做不了,后续会完成它。",
"click-link": "当前点击的链接是: "
},
"general": {
"open": "打开",
"save": "保存",
"file": "文件"
}
}