mirror of
https://github.com/veops/cmdb.git
synced 2025-08-25 20:09:00 +08:00
feat(ui): update i18n
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-cmn-Hans">
|
<html lang="zh-cmn-Hans">
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
@@ -12,17 +11,19 @@
|
|||||||
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
|
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
|
||||||
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
|
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
|
||||||
<% } %>
|
<% } %>
|
||||||
<script>
|
<script>
|
||||||
|
const userAgent = navigator.userAgent
|
||||||
const userAgent = navigator.userAgent
|
|
||||||
const isEdge = userAgent.indexOf("Edge") > -1
|
const isEdge = userAgent.indexOf("Edge") > -1
|
||||||
const isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1 && !isEdge
|
const isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1 && !isEdge
|
||||||
if (!isChrome) {
|
const lang = (navigator.language || navigator.userLanguage || '').toLowerCase()
|
||||||
alert("推荐使用Chrome浏览器, 其他环境下未做严格测试!")
|
if (!isChrome) {
|
||||||
|
if (lang.startsWith('zh')) {
|
||||||
|
alert("推荐使用Chrome浏览器,其他环境下未做严格测试!");
|
||||||
|
} else {
|
||||||
|
alert("It is recommended to use Chrome browser. Other environments are not strictly tested!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -30,10 +31,10 @@
|
|||||||
</noscript>
|
</noscript>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div id="loading-mask">
|
<div id="loading-mask">
|
||||||
<div class="loading-wrapper">
|
<div class="loading-wrapper">
|
||||||
<span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span>
|
<span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- require cdn assets js -->
|
<!-- require cdn assets js -->
|
||||||
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
|
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
|
||||||
|
@@ -63,7 +63,14 @@
|
|||||||
show-quick-jumper
|
show-quick-jumper
|
||||||
:current="tablePage.currentPage"
|
:current="tablePage.currentPage"
|
||||||
:total="tablePage.total"
|
:total="tablePage.total"
|
||||||
:show-total="(total, range) => `当前展示 ${range[0]}-${range[1]} 条数据, 共 ${total} 条`"
|
:show-total="
|
||||||
|
(total, range) =>
|
||||||
|
$t('pagination.total', {
|
||||||
|
range0: range[0],
|
||||||
|
range1: range[1],
|
||||||
|
total,
|
||||||
|
})
|
||||||
|
"
|
||||||
:page-size="tablePage.pageSize"
|
:page-size="tablePage.pageSize"
|
||||||
:default-current="1"
|
:default-current="1"
|
||||||
:page-size-options="pageSizeOptions"
|
:page-size-options="pageSizeOptions"
|
||||||
|
@@ -138,7 +138,14 @@
|
|||||||
show-quick-jumper
|
show-quick-jumper
|
||||||
:current="tablePage.currentPage"
|
:current="tablePage.currentPage"
|
||||||
:total="tablePage.total"
|
:total="tablePage.total"
|
||||||
:show-total="(total, range) => `当前展示 ${range[0]}-${range[1]} 条数据, 共 ${total} 条`"
|
:show-total="
|
||||||
|
(total, range) =>
|
||||||
|
$t('pagination.total', {
|
||||||
|
range0: range[0],
|
||||||
|
range1: range[1],
|
||||||
|
total,
|
||||||
|
})
|
||||||
|
"
|
||||||
:page-size="tablePage.pageSize"
|
:page-size="tablePage.pageSize"
|
||||||
:default-current="1"
|
:default-current="1"
|
||||||
:page-size-options="pageSizeOptions"
|
:page-size-options="pageSizeOptions"
|
||||||
|
@@ -107,7 +107,14 @@
|
|||||||
show-quick-jumper
|
show-quick-jumper
|
||||||
:current="tablePage.currentPage"
|
:current="tablePage.currentPage"
|
||||||
:total="tablePage.total"
|
:total="tablePage.total"
|
||||||
:show-total="(total, range) => `当前展示 ${range[0]}-${range[1]} 条数据, 共 ${total} 条`"
|
:show-total="
|
||||||
|
(total, range) =>
|
||||||
|
$t('pagination.total', {
|
||||||
|
range0: range[0],
|
||||||
|
range1: range[1],
|
||||||
|
total,
|
||||||
|
})
|
||||||
|
"
|
||||||
:page-size="tablePage.pageSize"
|
:page-size="tablePage.pageSize"
|
||||||
:default-current="1"
|
:default-current="1"
|
||||||
:page-size-options="pageSizeOptions"
|
:page-size-options="pageSizeOptions"
|
||||||
|
@@ -7,6 +7,7 @@ import notification from 'ant-design-vue/es/notification'
|
|||||||
import { ACCESS_TOKEN } from '@/store/global/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/global/mutation-types'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
import i18n from '@/lang'
|
||||||
|
|
||||||
// 创建 axios 实例
|
// 创建 axios 实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
@@ -20,15 +21,16 @@ const err = (error) => {
|
|||||||
console.log(error)
|
console.log(error)
|
||||||
const reg = /5\d{2}/g
|
const reg = /5\d{2}/g
|
||||||
if (error.response && reg.test(error.response.status)) {
|
if (error.response && reg.test(error.response.status)) {
|
||||||
const errorMsg = ((error.response || {}).data || {}).message || '服务端未知错误, 请联系管理员!'
|
const errorMsg = ((error.response || {}).data || {}).message || i18n.t('requestServiceError')
|
||||||
message.error(errorMsg)
|
message.error(errorMsg)
|
||||||
} else if (error.response.status === 412) {
|
} else if (error.response.status === 412) {
|
||||||
let seconds = 5
|
let seconds = 5
|
||||||
notification.warning({
|
notification.warning({
|
||||||
key: 'notification',
|
key: 'notification',
|
||||||
message: 'WARNING',
|
message: 'WARNING',
|
||||||
description:
|
description: i18n.t('requestWait', {
|
||||||
'修改已提交,请等待审核(5s)',
|
time: 5,
|
||||||
|
}),
|
||||||
duration: 5,
|
duration: 5,
|
||||||
})
|
})
|
||||||
let interval = setInterval(() => {
|
let interval = setInterval(() => {
|
||||||
@@ -41,14 +43,15 @@ const err = (error) => {
|
|||||||
notification.warning({
|
notification.warning({
|
||||||
key: 'notification',
|
key: 'notification',
|
||||||
message: 'WARNING',
|
message: 'WARNING',
|
||||||
description:
|
description: i18n.t('requestWait', {
|
||||||
`修改已提交,请等待审核(${seconds}s)`,
|
time: seconds,
|
||||||
|
}),
|
||||||
duration: seconds
|
duration: seconds
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else if (error.config.url === '/api/v0.1/ci_types/can_define_computed' || error.config.isShowMessage === false) {
|
} else if (error.config.url === '/api/v0.1/ci_types/can_define_computed' || error.config.isShowMessage === false) {
|
||||||
} else {
|
} else {
|
||||||
const errorMsg = ((error.response || {}).data || {}).message || '出现错误,请稍后再试'
|
const errorMsg = ((error.response || {}).data || {}).message || i18n.t('requestError')
|
||||||
message.error(`${errorMsg}`)
|
message.error(`${errorMsg}`)
|
||||||
}
|
}
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
|
Reference in New Issue
Block a user