feat(ui): update i18n

This commit is contained in:
LH_R
2025-06-18 15:35:45 +08:00
parent f8fbbe4b9a
commit 72c37c995d
11 changed files with 124 additions and 37 deletions

View File

@@ -47,7 +47,7 @@ export const commonIconList = ['changyong-ubuntu',
export const linearIconList = [ export const linearIconList = [
{ {
value: 'database', value: 'database',
label: '数据库', label: 'components.database',
list: [{ list: [{
value: 'icon-xianxing-DB2', value: 'icon-xianxing-DB2',
label: 'DB2' label: 'DB2'
@@ -81,7 +81,7 @@ export const linearIconList = [
}] }]
}, { }, {
value: 'system', value: 'system',
label: '操作系统', label: 'components.system',
list: [{ list: [{
value: 'icon-xianxing-Windows', value: 'icon-xianxing-Windows',
label: 'Windows' label: 'Windows'
@@ -106,7 +106,7 @@ export const linearIconList = [
}] }]
}, { }, {
value: 'language', value: 'language',
label: '语言', label: 'components.language',
list: [{ list: [{
value: 'icon-xianxing-python', value: 'icon-xianxing-python',
label: 'python' label: 'python'
@@ -137,7 +137,7 @@ export const linearIconList = [
}] }]
}, { }, {
value: 'status', value: 'status',
label: '状态', label: 'components.status',
list: [{ list: [{
value: 'icon-xianxing-yiwen', value: 'icon-xianxing-yiwen',
label: '疑问' label: '疑问'
@@ -177,7 +177,7 @@ export const linearIconList = [
}] }]
}, { }, {
value: 'icon-xianxing-application', value: 'icon-xianxing-application',
label: '常用组件', label: 'components.commonComponent',
list: [{ list: [{
value: 'icon-xianxing-yilianjie', value: 'icon-xianxing-yilianjie',
label: '已连接' label: '已连接'
@@ -310,7 +310,7 @@ export const linearIconList = [
}] }]
}, { }, {
value: 'data', value: 'data',
label: '数据', label: 'components.data',
list: [{ list: [{
value: 'icon-xianxing-bingzhuangtu', value: 'icon-xianxing-bingzhuangtu',
label: '饼状图' label: '饼状图'
@@ -387,7 +387,7 @@ export const linearIconList = [
export const fillIconList = [ export const fillIconList = [
{ {
value: 'database', value: 'database',
label: '数据库', label: 'components.database',
list: [{ list: [{
value: 'icon-shidi-DB2', value: 'icon-shidi-DB2',
label: 'DB2' label: 'DB2'
@@ -421,7 +421,7 @@ export const fillIconList = [
}] }]
}, { }, {
value: 'system', value: 'system',
label: '操作系统', label: 'components.system',
list: [{ list: [{
value: 'icon-shidi-Windows', value: 'icon-shidi-Windows',
label: 'Windows' label: 'Windows'
@@ -446,7 +446,7 @@ export const fillIconList = [
}] }]
}, { }, {
value: 'language', value: 'language',
label: '语言', label: 'components.language',
list: [{ list: [{
value: 'icon-shidi-python', value: 'icon-shidi-python',
label: 'python' label: 'python'
@@ -477,7 +477,7 @@ export const fillIconList = [
}] }]
}, { }, {
value: 'status', value: 'status',
label: '状态', label: 'components.status',
list: [{ list: [{
value: 'icon-shidi-yiwen', value: 'icon-shidi-yiwen',
label: '疑问' label: '疑问'
@@ -517,7 +517,7 @@ export const fillIconList = [
}] }]
}, { }, {
value: 'icon-shidi-application', value: 'icon-shidi-application',
label: '常用组件', label: 'components.commonComponent',
list: [{ list: [{
value: 'icon-shidi-yilianjie', value: 'icon-shidi-yilianjie',
label: '已连接' label: '已连接'
@@ -650,7 +650,7 @@ export const fillIconList = [
}] }]
}, { }, {
value: 'data', value: 'data',
label: '数据', label: 'components.data',
list: [{ list: [{
value: 'icon-shidi-bingzhuangtu', value: 'icon-shidi-bingzhuangtu',
label: '饼状图' label: '饼状图'
@@ -727,7 +727,7 @@ export const fillIconList = [
export const multicolorIconList = [ export const multicolorIconList = [
{ {
value: 'database', value: 'database',
label: '数据库', label: 'components.database',
list: [{ list: [{
value: 'caise-TIDB', value: 'caise-TIDB',
label: 'TIDB' label: 'TIDB'
@@ -773,7 +773,7 @@ export const multicolorIconList = [
}] }]
}, { }, {
value: 'cloud', value: 'cloud',
label: '', label: 'components.cloud',
list: [{ list: [{
value: 'AWS', value: 'AWS',
label: 'AWS' label: 'AWS'
@@ -819,7 +819,7 @@ export const multicolorIconList = [
}] }]
}, { }, {
value: 'system', value: 'system',
label: '操作系统', label: 'components.system',
list: [{ list: [{
value: 'ciase-aix', value: 'ciase-aix',
label: 'aix' label: 'aix'
@@ -847,7 +847,7 @@ export const multicolorIconList = [
}] }]
}, { }, {
value: 'language', value: 'language',
label: '语言', label: 'components.language',
list: [{ list: [{
value: 'caise-python', value: 'caise-python',
label: 'python' label: 'python'
@@ -878,7 +878,7 @@ export const multicolorIconList = [
}] }]
}, { }, {
value: 'status', value: 'status',
label: '状态', label: 'components.status',
list: [{ list: [{
value: 'caise-yiwen', value: 'caise-yiwen',
label: '疑问' label: '疑问'
@@ -918,7 +918,7 @@ export const multicolorIconList = [
}] }]
}, { }, {
value: 'caise-application', value: 'caise-application',
label: '常用组件', label: 'components.commonComponent',
list: [{ list: [{
value: 'caise-websphere', value: 'caise-websphere',
label: 'WebSphere' label: 'WebSphere'
@@ -1180,7 +1180,7 @@ export const multicolorIconList = [
}] }]
}, { }, {
value: 'data', value: 'data',
label: '数据', label: 'components.data',
list: [{ list: [{
value: 'caise-bingzhuangtu', value: 'caise-bingzhuangtu',
label: '饼状图' label: '饼状图'

View File

@@ -33,7 +33,7 @@
<template v-if="iconList && iconList.length"> <template v-if="iconList && iconList.length">
<template v-if="currentIconType !== '4'"> <template v-if="currentIconType !== '4'">
<div v-for="category in iconList" :key="category.value"> <div v-for="category in iconList" :key="category.value">
<h4 class="category">{{ category.label }}</h4> <h4 class="category">{{ $t(category.label) }}</h4>
<div class="custom-icon-select-popover-content-wrapper"> <div class="custom-icon-select-popover-content-wrapper">
<div <div
v-for="name in category.list" v-for="name in category.list"

View File

@@ -6,9 +6,9 @@
</div> </div>
<div class="content"> <div class="content">
<h1>{{ config[type].title }}</h1> <h1>{{ config[type].title }}</h1>
<div class="desc">{{ config[type].desc }}</div> <div class="desc">{{ $t(config[type].desc) }}</div>
<div class="actions"> <div class="actions">
<a-button type="primary" @click="handleToHome">返回首页</a-button> <a-button type="primary" @click="handleToHome">{{ $t('exception.backToHome') }}</a-button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -2,17 +2,17 @@ const types = {
403: { 403: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg', img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
title: '403', title: '403',
desc: '抱歉,你无权访问该页面' desc: 'exception.desc1'
}, },
404: { 404: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg', img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
title: '404', title: '404',
desc: '抱歉,你访问的页面不存在或仍在开发中' desc: 'exception.desc2'
}, },
500: { 500: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg', img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
title: '500', title: '500',
desc: '抱歉,服务器出错了' desc: 'exception.desc3'
} }
} }

View File

@@ -109,9 +109,25 @@ export default {
default: 'default', default: 'default',
tip: 'Tip', tip: 'Tip',
cmdbSearch: 'Search', cmdbSearch: 'Search',
exception: {
backToHome: 'Back to home page',
desc1: 'Sorry, you are not authorized to access this page',
desc2: 'Sorry, the page you are visiting does not exist or is still under development',
desc3: 'Sorry, server error'
},
pagination: { pagination: {
total: '{range0}-{range1} of {total} items' total: '{range0}-{range1} of {total} items'
}, },
components: {
colorTagSelectTip: 'Enter or select tags',
database: 'Database',
system: 'System',
language: 'Language',
status: 'Status',
commonComponent: 'Common Component',
data: 'Data',
cloud: 'Cloud'
},
topMenu: { topMenu: {
personalCenter: 'My Profile', personalCenter: 'My Profile',
logout: 'Logout', logout: 'Logout',

View File

@@ -109,9 +109,25 @@ export default {
default: '默认', default: '默认',
tip: '提示', tip: '提示',
cmdbSearch: '搜索一下', cmdbSearch: '搜索一下',
exception: {
backToHome: '返回首页',
desc1: '抱歉,你无权访问该页面',
desc2: '抱歉,你访问的页面不存在或仍在开发中',
desc3: '抱歉,服务器出错了'
},
pagination: { pagination: {
total: '当前展示 {range0}-{range1} 条数据, 共 {total} 条' total: '当前展示 {range0}-{range1} 条数据, 共 {total} 条'
}, },
components: {
colorTagSelectTip: '选择或输入(回车确定)标签',
database: '数据库',
system: '操作系统',
language: '语言',
status: '状态',
commonComponent: '常用组件',
data: '数据',
cloud: '云'
},
topMenu: { topMenu: {
personalCenter: '个人中心', personalCenter: '个人中心',
logout: '退出登录', logout: '退出登录',

View File

@@ -1,8 +1,10 @@
import _ from 'lodash' import _ from 'lodash'
import i18n from '@/lang'
export function timeFix() { export function timeFix() {
const time = new Date() const time = new Date()
const hour = time.getHours() const hour = time.getHours()
return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好' return hour < 9 ? i18n.t('cs.login.welcomeTime1') : hour <= 11 ? i18n.t('cs.login.welcomeTime2') : hour <= 13 ? i18n.t('cs.login.welcomeTime3') : hour < 20 ? i18n.t('cs.login.welcomeTime4') : i18n.t('cs.login.welcomeTime5')
} }
export function welcome() { export function welcome() {

View File

@@ -23,7 +23,7 @@
<a-form-model-item :label="$t('cs.auth.oauth2.tokenUrl')" prop="token_url"> <a-form-model-item :label="$t('cs.auth.oauth2.tokenUrl')" prop="token_url">
<a-input v-model="form.token_url" :placeholder="$t('cs.auth.oauth2.tokenUrlPlaceholder')" /> <a-input v-model="form.token_url" :placeholder="$t('cs.auth.oauth2.tokenUrlPlaceholder')" />
</a-form-model-item> </a-form-model-item>
<SpanTitle>其他</SpanTitle> <SpanTitle>{{ $t('cs.auth.other') }}</SpanTitle>
<a-form-model-item :label="$t('cs.auth.oauth2.userInfo')" prop="user_info" :wrapper-col="{ span: 15 }"> <a-form-model-item :label="$t('cs.auth.oauth2.userInfo')" prop="user_info" :wrapper-col="{ span: 15 }">
<vue-json-editor <vue-json-editor
:style="{ '--custom-height': `${200}px` }" :style="{ '--custom-height': `${200}px` }"

View File

@@ -445,6 +445,27 @@ const cs_en = {
test: 'Test', test: 'Test',
selectApp: 'Select App', selectApp: 'Select App',
}, },
login: {
loginText: 'OneOps making operations simple',
username: 'Username/Email',
usernameRequired: 'Please input Username/Email',
password: 'Password',
passwordRequired: 'Please input Password',
captcha: 'Captcha',
captchaRequired: 'Please input Captcha',
loginBtn: 'Login',
autoLogin: 'Auto Login',
otherLoginWay: 'Other Login',
welcomeMessage: 'Welcome',
welcomeDesc: '{name} Welcome Back',
welcomeTime1: 'Good Morning',
welcomeTime2: 'Good Morning',
welcomeTime3: 'Good Afternoon',
welcomeTime4: 'Good Afternoon',
welcomeTime5: 'Good Evening',
oneDeviceLogin: 'Login on one device only',
logoutSoon: 'Logging Out Soon...',
}
} }
export default cs_en export default cs_en

View File

@@ -443,5 +443,26 @@ const cs_zh = {
test: '测试', test: '测试',
selectApp: '选择应用', selectApp: '选择应用',
}, },
login: {
loginText: '维易科技 让运维变简单',
username: '用户名/邮箱',
usernameRequired: '请输入用户名或邮箱',
password: '密码',
passwordRequired: '请输入密码',
captcha: '图片验证码',
captchaRequired: '请输入验证码',
loginBtn: '登录',
autoLogin: '自动登录',
otherLoginWay: '其他登录方式',
welcomeMessage: '欢迎',
welcomeDesc: '{name} 欢迎回来',
welcomeTime1: '早上好',
welcomeTime2: '上午好',
welcomeTime3: '中午好',
welcomeTime4: '下午好',
welcomeTime5: '晚上好',
oneDeviceLogin: '只能在一个设备上登录',
logoutSoon: '即将登出...',
}
} }
export default cs_zh export default cs_zh

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="ops-login"> <div class="ops-login">
<div class="ops-login-left"> <div class="ops-login-left">
<span>维易科技 &nbsp;&nbsp; 让运维变简单</span> <span>{{ $t('cs.login.loginText') }}</span>
</div> </div>
<div class="ops-login-right"> <div class="ops-login-right">
<img src="../../assets/logo_VECMDB.png" /> <img src="../../assets/logo_VECMDB.png" />
@@ -12,7 +12,7 @@
@submit="handleSubmit" @submit="handleSubmit"
hideRequiredMark hideRequiredMark
:colon="false"> :colon="false">
<a-form-item label="用户名/邮箱"> <a-form-item :label="$t('cs.login.username')">
<a-input <a-input
size="large" size="large"
type="text" type="text"
@@ -20,7 +20,10 @@
v-decorator="[ v-decorator="[
'username', 'username',
{ {
rules: [{ required: true, message: '请输入用户名或邮箱' }, { validator: handleUsernameOrEmail }], rules: [
{ required: true, message: $t('cs.login.usernameRequired') },
{ validator: handleUsernameOrEmail }
],
validateTrigger: 'change', validateTrigger: 'change',
}, },
]" ]"
@@ -28,19 +31,24 @@
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item label="密码"> <a-form-item :label="$t('cs.login.password')">
<a-input <a-input
size="large" size="large"
type="password" type="password"
autocomplete="false" autocomplete="false"
class="ops-input" class="ops-input"
v-decorator="['password', { rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur' }]" v-decorator="[
'password',
{ rules: [{ required: true, message: $t('cs.login.passwordRequired') }], validateTrigger: 'blur' }
]"
> >
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-checkbox v-decorator="['rememberMe', { valuePropName: 'checked' }]">自动登录</a-checkbox> <a-checkbox v-decorator="['rememberMe', { valuePropName: 'checked' }]">
{{ $t('cs.login.autoLogin') }}
</a-checkbox>
</a-form-item> </a-form-item>
<a-form-item style="margin-top:24px"> <a-form-item style="margin-top:24px">
@@ -51,8 +59,9 @@
class="login-button" class="login-button"
:loading="state.loginBtn" :loading="state.loginBtn"
:disabled="state.loginBtn" :disabled="state.loginBtn"
>登录</a-button
> >
{{ $t('cs.login.loginBtn') }}
</a-button>
<a-checkbox <a-checkbox
v-if="hasLDAP" v-if="hasLDAP"
v-model="auth_with_ldap" v-model="auth_with_ldap"
@@ -62,7 +71,9 @@
</a-form-item> </a-form-item>
</a-form> </a-form>
<template v-if="_enable_list && _enable_list.length >= 1"> <template v-if="_enable_list && _enable_list.length >= 1">
<a-divider style="font-size:14px">其他登录方式</a-divider> <a-divider style="font-size:14px">
{{ $t('cs.login.otherLoginWay') }}
</a-divider>
<div style="text-align:center"> <div style="text-align:center">
<span v-for="(item, index) in _enable_list" :key="item.auth_type"> <span v-for="(item, index) in _enable_list" :key="item.auth_type">
<ops-icon :type="item.auth_type" /> <ops-icon :type="item.auth_type" />
@@ -183,8 +194,8 @@ export default {
// 延迟 1 秒显示欢迎信息 // 延迟 1 秒显示欢迎信息
setTimeout(() => { setTimeout(() => {
this.$notification.success({ this.$notification.success({
message: '欢迎', message: this.$t('cs.login.welcomeMessage'),
description: `${timeFix()}欢迎回来`, description: this.$t('cs.login.welcomeDesc', { name: timeFix() }),
}) })
}, 1000) }, 1000)
}, },