feat: 国际化

This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-11-19 18:12:56 +08:00
parent 1768c963eb
commit 8e6eff54f4
23 changed files with 438 additions and 101 deletions

111
src/locales/en.ts Normal file
View File

@@ -0,0 +1,111 @@
export default {
button: {
enterLottery: 'Enter Lottery',
start:'Start',
selectLucky:'Draw the Lucky',
continue: 'Continue',
confirm: 'Confirm',
cancel: 'Cancel',
setting: 'Setting',
delete: 'Delete',
allDelete: 'Delete All',
downloadTemplate: 'Download Template',
importData: 'Import Data',
resetData: 'Reset Data',
exportResult: 'Export Result',
add: 'Add',
resetDefault: 'Reset Default',
resetAllData: 'Reset All Data',
clearPattern: 'Clear Pattern',
DefaultPattern: 'Default Pattern',
upload: 'Upload',
reset: 'Reset',
play: 'Play',
setLayout:'Set Layout',
close:'Close'
},
sidebar:{
personConfiguration:'Person Configuration',
personList:'Person List',
winnerList:'Winner List',
prizeConfiguration:'Prize Configuration',
globalSetting:'Global Configuration',
viewSetting:'View Setting',
imagesManagement:'Images Management',
musicManagement:'Music Management',
operatingInstructions:'Operating Instructions'
},
viewTitle:{
personManagement:'Person Management',
winnerManagement:'Winner Management',
prizeManagement:'Prize Management',
globalSetting:'Global Setting',
operatingInstructions:'Operating Instructions'
},
table:{
// person configuration
number:'Number',
name:'Name',
prizeName:'Name',
department:'Department',
identity:'Identity',
isLucky:'Is Lucky',
operation:'Operation',
luckyPeopleNumber:'Lucky People Number',
detail:'Detail',
// prize configuration
fullParticipation:'FullParticipation',
numberParticipants:'NumberParticipants',
isDone:'is Done',
image:'Image',
onceNumber:'Once Number',
time:'Time',
// view setting
title:'Main Title',
columnNumber:'Column Number',
theme:'Theme',
language:'Language',
cardColor:'Card Color',
winnerColor:'Winner Color',
textColor:'Text Color',
cardWidth:'Card Width',
cardHeight:'Card Height',
textSize:'Text Size',
highlightColor:'HighLight Color',
patternSetting:'Pattern Setting',
alwaysDisplay:'Always Display Prize List',
},
dialog:{
titleTip:'Tip!',
titleTemporary:'Add Temporary Activity',
dialogPCWeb:'Please use a PC browser to access for optimal display performance',
dialogDelAllPerson:'This operation will delete all personnel list data. Do you want to continue?',
dialogResetWinner:'This operation will clear the winning information of personnel. Do you want to continue?',
dialogResetAllData:'This operation will reset all data. Do you want to continue?',
dialogSingleDrawLimit:'Only 10 characters can be extracted in a single draw',
dialogLatestBrowser:'Please use the latest version of Chrome or Edge browser',
tipResetPrize:'Performing operations may reset data, please proceed with caution',
},
tooltip:{
settingConfiguration:'Setting/Configuration',
nextSong:'Right Click to Next Song',
noSongPlay:'No Song to Play',
prizeList:'Prize List',
addActivity:'Add Activity',
downloadTemplateTip:'After downloading the file, please fill in the data in Excel and save it in xlsx format',
uploadExcelTip:'Upload the modified Excel file',
leftClick:'Left Click to Slice',
toHome:'to Home',
resetLayout:'This item is time-consuming and performance intensive',
defaultLayout:'The default pattern setting is valid for 17 columns, please set the number of other columns yourself',
doneCount:'Number of winners',
edit:'Edit',
delete:'Delete'
},
footer:{
'self-reflection':'Turn inward and examine yourself when you encounter difficulties in life.',
'thiefEasy':'Thief difficult mountain thief easily, breaking heart.'
}
}

29
src/locales/i18n.ts Normal file
View File

@@ -0,0 +1,29 @@
// i18n配置
import { createI18n } from "vue-i18n";
import zhCn from "./zhCn";
import en from "./en";
export type Language='en'|'zhCn'
export const languageList=[
{
key:'zhCn',
name:'中文'
},
{
key:'en',
name:'English'
}
]
// 创建i18n
const i18n = createI18n({
locale: JSON.parse(localStorage.getItem("globalConfig")?localStorage.getItem("globalConfig") as string:"{globalConfig:{language:'zhCn'}}").globalConfig.language || "zhCn", // 语言标识
globalInjection: true, // 全局注入,可以直接使用$t
// 处理报错: Uncaught (in promise) SyntaxError: Not available in legacy mode (at message-compiler.esm-bundler.js:54:19)
legacy:false,
messages: {
zhCn,
en
}
})
export default i18n;

111
src/locales/zhCn.ts Normal file
View File

@@ -0,0 +1,111 @@
export default {
button: {
enterLottery: '进入抽奖',
start:'开始',
selectLucky:'抽取幸运儿',
continue: '继续',
confirm: '确认',
cancel: '取消',
setting: '设置',
delete: '删除',
allDelete: '删除全部',
downloadTemplate: '下载模板',
importData: '导入数据',
resetData: '重置数据',
exportResult: '导出结果',
add: '添加',
resetDefault: '重置为默认',
resetAllData: '重置所有数据',
clearPattern: '清除图案',
DefaultPattern: '默认图案',
upload: '上传',
reset: '重置',
play: '播放',
setLayout:'重设布局',
close:'关闭'
},
sidebar:{
personConfiguration:'人员配置',
personList:'人员列表',
winnerList:'中奖人员',
prizeConfiguration:'奖品配置',
globalSetting:'全局配置',
viewSetting:'界面设置',
imagesManagement:'图片管理',
musicManagement:'音乐管理',
operatingInstructions:'操作说明'
},
viewTitle:{
personManagement:'人员管理',
winnerManagement:'已中奖人员管理',
prizeManagement:'奖项配置',
globalSetting:'全局配置',
operatingInstructions:'操作说明'
},
table:{
// person configuration
number:'编号',
name:'姓名',
prizeName:'名称',
department:'部门',
identity:'身份',
isLucky:'是否中奖',
operation:'操作',
luckyPeopleNumber:'中奖人数',
detail:'详细信息',
// prize configuration
fullParticipation:'全员参加',
numberParticipants:'抽奖人数',
isDone:'已抽取',
image:'图片',
onceNumber:'单次抽取个数',
time:'时间',
// view setting
title:'主标题',
columnNumber:'列数',
theme:'主题',
language:'语言',
cardColor:'卡片颜色',
winnerColor:'中奖卡片颜色',
textColor:'文字颜色',
cardWidth:'卡片宽度',
cardHeight:'卡片高度',
textSize:'文字大小',
highlightColor:'高亮颜色',
patternSetting:'图案设置',
alwaysDisplay:'常显奖项列表',
},
dialog:{
titleTip:'提示!',
titleTemporary:'增加临时抽奖',
dialogPCWeb:'请使用PC进行访问以获得最佳显示效果',
dialogDelAllPerson:'该操作会删除所有人员数据,是否继续?',
dialogResetWinner:'该操作会清空人员中奖信息,是否继续?',
dialogResetAllData:'该操作会重置所有数据,是否继续?',
dialogSingleDrawLimit:'单次抽取只能抽取10位',
dialogLatestBrowser:'请使用最新版Chrome或者Edge浏览器',
tipResetPrize:'进行操作可能会重置数据,请谨慎操作',
},
tooltip:{
settingConfiguration:'设置/配置',
nextSong:'右键点击下一首',
noSongPlay:'没有音乐可以播放',
prizeList:'奖项列表',
addActivity:'添加抽奖',
downloadTemplateTip:'下载文件后请在excel中填写数据并保存为xlsx格式',
uploadExcelTip:'上传修改好的excel文件',
leftClick:'左键切割',
toHome:'主页',
resetLayout:'该项比较耗费时间和性能',
defaultLayout:'默认图案设置针对17列时有效其他列数请自行设置',
doneCount:'已抽取',
edit:'编辑',
delete:'删除'
},
footer:{
'self-reflection':'行有不得,反求诸己',
'thiefEasy':'破山中贼易,破心中贼难'
}
}