feat: i18n,add en and zh-cn language.

This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-11-22 14:53:36 +08:00
parent 8e6eff54f4
commit 391142223f
18 changed files with 189 additions and 116 deletions

View File

@@ -51,9 +51,11 @@ export default {
identity:'Identity',
isLucky:'Is Lucky',
operation:'Operation',
setLuckyNumber:'Set Lucky Number',
luckyPeopleNumber:'Lucky People Number',
detail:'Detail',
noneData:'No Data',
// prize configuration
fullParticipation:'FullParticipation',
numberParticipants:'NumberParticipants',
@@ -75,6 +77,7 @@ export default {
highlightColor:'HighLight Color',
patternSetting:'Pattern Setting',
alwaysDisplay:'Always Display Prize List',
selectPicture:'Select a Picture'
},
dialog:{
titleTip:'Tip!',
@@ -103,7 +106,42 @@ export default {
edit:'Edit',
delete:'Delete'
},
error:{
require:'required field',
requireNumber:'please enter a number',
minNumber1:'the minimum is 1',
maxNumber100:'the maximum is 100',
uploadSuccess:'Upload Success',
uploadFail:'Upload Failed',
notImage:'Not Image',
personIsAllDone:'All Person Is Done',
personNotEnough:'Person Is Not Enough',
noInfoAndImport:'No Info and import it',
useDefault:'Use Default Data',
completeInformation:'Please provide complete information'
},
placeHolder:{
enterTitle:'Enter Title',
name:'Name',
winnerCount:'Lucky Person Count',
},
data:{
yes:'Yes',
no:'No',
number:'Number',
isWin:'isWin',
department:'Department',
name:'Name',
identity:'Identity',
prizeName:'Prize Name',
prizeTime:'Prize Time',
operation:'Operation',
delete:'Delete',
removePerson:'Remove the Person',
defaultTitle:'The Prelude to the Six Ministries of the Ming Dynasty Cabinet',
xlsxName:'personListTemplate-en.xlsx',
readmeName:'readme-en.md'
},
footer:{
'self-reflection':'Turn inward and examine yourself when you encounter difficulties in life.',
'thiefEasy':'Thief difficult mountain thief easily, breaking heart.'

View File

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

View File

@@ -22,7 +22,9 @@ export default {
reset: '重置',
play: '播放',
setLayout:'重设布局',
close:'关闭'
close:'关闭',
noInfoAndImport:'暂无人员信息,前往导入',
useDefault:'使用默认数据'
},
sidebar:{
personConfiguration:'人员配置',
@@ -51,9 +53,11 @@ export default {
identity:'身份',
isLucky:'是否中奖',
operation:'操作',
setLuckyNumber:'设置中奖人数',
luckyPeopleNumber:'中奖人数',
detail:'详细信息',
noneData:'暂无数据',
// prize configuration
fullParticipation:'全员参加',
numberParticipants:'抽奖人数',
@@ -75,6 +79,7 @@ export default {
highlightColor:'高亮颜色',
patternSetting:'图案设置',
alwaysDisplay:'常显奖项列表',
selectPicture:'选择一张图片'
},
dialog:{
titleTip:'提示!',
@@ -103,7 +108,41 @@ export default {
edit:'编辑',
delete:'删除'
},
error:{
require:'必填项',
requireNumber:'请输入数字',
minNumber1:'最小为1',
maxNumber100:'最大为100',
uploadSuccess:'上传成功',
uploadFail:'上传失败',
notImage:'不是图片',
personIsAllDone:'抽奖抽完了',
personNotEnough:'抽奖人数不足',
startDraw:'现在抽取{count}{leftover}人',
completeInformation:'请填写完整信息'
},
placeHolder:{
enterTitle:'输入标题',
name:'名称',
winnerCount:'中奖人数',
},
data:{
yes:'是',
no:'否',
number:'编号',
isWin:'是否中奖',
department:'部门',
name:'姓名',
identity:'身份',
prizeName:'获奖',
prizeTime:'获奖时间',
operation:'操作',
delete:'删除',
removePerson:'移入未中奖名单',
defaultTitle:'大明内阁六部御前奏对',
xlsxName:'人口登记表-zhCn.xlsx',
readmeName:'readme-zhCn.md'
},
footer:{
'self-reflection':'行有不得,反求诸己',
'thiefEasy':'破山中贼易,破心中贼难'