feat: add international language support for workplace page; 🌟

新增:工作台页面增加国际化语言支持;
This commit is contained in:
iczer
2020-06-24 18:53:17 +08:00
parent ff4364262d
commit fa3fa22f3c
8 changed files with 136 additions and 29 deletions

View File

@@ -8,10 +8,23 @@ const avatars = [
]
const positions = [
'JAVA工程师 | 蚂蚁金服-计算服务事业群-微信平台部',
'前端工程师 | 蚂蚁金服-计算服务事业群-VUE平台',
'前端工程 | 蚂蚁金服-算服务事业群-REACT平台',
'产品分析师 | 蚂蚁金服-计算服务事业群-IOS平台部'
{
CN: 'Java工程师 | 蚂蚁金服-计算服务事业群-微信平台',
HK: 'Java工程 | 螞蟻金服-算服務事業群-微信平台',
US: 'Java engineer | Ant financial - Computing services business group - WeChat platform division'
},{
CN: '前端工程师 | 蚂蚁金服-计算服务事业群-VUE平台',
HK: '前端工程師 | 螞蟻金服-計算服務事業群-VUE平台',
US: 'Front-end engineer | Ant Financial - Computing services business group - VUE platform'
},{
CN: '前端工程师 | 蚂蚁金服-计算服务事业群-REACT平台',
HK: '前端工程師 | 螞蟻金服-計算服務事業群-REACT平台',
US: 'Front-end engineer | Ant Financial - Computing services business group - REACT platform'
},{
CN: '产品分析师 | 蚂蚁金服-计算服务事业群-IOS平台部',
HK: '產品分析師 | 螞蟻金服-計算服務事業群-IOS平台部',
US: 'Product analyst | Ant Financial - Computing services business group - IOS platform division'
}
]
const sayings = [

View File

@@ -3,17 +3,60 @@ import {logos, sayings, positions, avatars, admins} from '../common'
const Random = Mock.Random
const timeList = [
{
CN: '早上好',
HK: '早晨啊',
US: 'Good morning',
},{
CN: '上午好',
HK: '上午好',
US: 'Good morning',
},{
CN: '中午好',
HK: '中午好',
US: 'Good afternoon',
},{
CN: '晚上好',
HK: '晚上好',
US: 'Good evening',
},
]
const welcomeMessages = [
{
CN: '休息一会儿吧',
HK: '休息一會兒吧',
US: 'you may need a break',
},
{
CN: '准备吃什么呢',
HK: '準備吃什麼呢',
US: 'what are you going to eat',
},
{
CN: '要不要打一把 DOTA',
HK: '要不要打一把 DOTA',
US: 'how about a game of DOTA',
},
{
CN: '我猜你可能累了',
HK: '我猜你可能累了',
US: 'i guess you might be tired',
}
]
Random.extend({
admin () {
return this.pick(admins)
},
welcome () {
return this.pick(['休息一会儿吧', '准备吃什么呢', '要不要打一把DOTA', '我猜你可能累了'])
return this.pick(welcomeMessages)
},
timefix () {
timeFix () {
const time = new Date()
const hour = time.getHours()
return hour < 9 ? '早上好' : (hour <= 11 ? '上午好' : (hour <= 13 ? '中午好' : (hour <= 20 ? '下午好' : '晚上好')))
return hour < 9 ? timeList[0] : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
},
avatar () {
return this.pick(avatars)

View File

@@ -8,7 +8,7 @@ const userDB = Mock.mock({
avatar: '@AVATAR',
address: '@CITY',
welcome: '@WELCOME',
timefix: '@TIMEFIX',
timeFix: '@TIMEFIX',
position: '@position'
}
]

View File

@@ -6,7 +6,7 @@ const user = Mock.mock({
avatar: '@AVATAR',
address: '@CITY',
welcome: '@WELCOME',
timefix: '@TIMEFIX',
timeFix: '@TIMEFIX',
position: '@POSITION'
})