ソースを参照

i18n(setting): 实现相机配置组件国际化支持

- 在 CameraConfig.vue 中引入 i18n 模块
- 将相机连接状态文本替换为多语言翻译函数
- 更新相机配置消息提示为国际化文本
- 在 check 组件对话框标题中添加翻译功能
panqiuyao 1 日 前
コミット
4a37e9384e

+ 1 - 1
frontend/src/components/check/index.vue

@@ -1,7 +1,7 @@
 <template>
   <el-dialog
     v-model="visible"
-    :title="title"
+    :title="$t(title)"
     :close-on-click-modal="false"
     :show-close="false"
     width="500px"

+ 7 - 6
frontend/src/views/Setting/components/CameraConfig.vue

@@ -106,6 +106,7 @@ import client from "@/stores/modules/client";
 import icpList from '@/utils/ipc';
 import socket from "@/stores/modules/socket.js";
 import useUserInfo from '@/stores/modules/user';
+import i18n from '@/locales';
 
 const clientStore = client();
 const socketStore = socket();
@@ -143,9 +144,9 @@ const getPointStatus = (pointKey) => {
 
 const getPointTagInfo = (pointKey) => {
   const status = getPointStatus(pointKey)
-  if (status === 'connected') return { text: '已连接相机', type: 'success' }
-  if (status === 'disconnected') return { text: '未连接相机', type: 'danger' }
-  return { text: '未设置相机', type: 'info' }
+  if (status === 'connected') return { text: i18n.global.t('cameraConfig.connected'), type: 'success' }
+  if (status === 'disconnected') return { text: i18n.global.t('cameraConfig.notConnected'), type: 'danger' }
+  return { text: i18n.global.t('cameraConfig.notSet'), type: 'info' }
 }
 
 const multiConfig = reactive({
@@ -235,12 +236,12 @@ const handleRefresh = async () => {
   try {
     const ok = await fetchCameraList()
     if (ok) {
-      ElMessage.success('相机连接状态已更新')
+      ElMessage.success(i18n.global.t('cameraConfig.cameraConnected'))
     } else {
-      ElMessage.warning('未获取到相机列表')
+      ElMessage.warning(i18n.global.t('cameraConfig.noCameraList'))
     }
   } catch {
-    ElMessage.error('刷新失败,请稍后重试')
+    ElMessage.error(i18n.global.t('cameraConfig.refreshFailed'))
   } finally {
     refreshing.value = false
   }