Kaynağa Gözat

i18n(photography): 国际化加载对话框文本并优化进度显示

- 将硬编码的中文文本替换为国际化字符串
- 添加 loadingDialog 相关的多语言配置
- 使用计算属性动态获取翻译文本
- 优化进度步骤组件中的状态判断逻辑
- 统一错误消息和按钮文本的国际化处理
panqiuyao 1 gün önce
ebeveyn
işleme
fa8a95d4e7

+ 9 - 0
frontend/src/locales/en.ts

@@ -538,6 +538,15 @@ export default {
   loadingDialog: {
     processing: 'Processing, please wait...',
     processComplete: 'Done. Click to open output folder',
+    openDir: 'Open Folder',
+    viewResults: 'View Results',
+    allFailed: 'All items generation failed',
+    waiting: 'Waiting',
+    processing: 'Processing',
+    completed: 'Completed',
+    failed: 'Failed',
+    currentProgress: '{current}/{total} items',
+    failedCount: 'Failed: {count}',
   },
 
   // Left/Right Foot Configuration

+ 9 - 0
frontend/src/locales/zh-CN.ts

@@ -551,6 +551,15 @@ export default {
   loadingDialog: {
     processing: '正在为您处理,请稍后...',
     processComplete: '处理完毕,点击打开最终图片目录',
+    openDir: '打开目录',
+    viewResults: '查看结果',
+    allFailed: '全部货号生成失败',
+    waiting: '等待处理',
+    processing: '正在处理',
+    completed: '处理完成',
+    failed: '处理失败',
+    currentProgress: '第{current}/{total}款',
+    failedCount: '失败:{count}款',
   },
 
   // 左右脚配置

+ 10 - 4
frontend/src/views/Photography/components/LoadingDialog.vue

@@ -45,7 +45,7 @@
       </el-button>
 
       <el-button
-          v-if="message  === '全部货号生成失败'"
+          v-if="message  === allFailedText"
           type="primary"
           class="action-button   button--primary1  mar-top-20"
           @click="visible = false"
@@ -59,12 +59,13 @@
 <script setup lang="ts">
 import { ref, defineProps, defineEmits , watch } from 'vue'
 import ProgressSteps from './ProgressSteps.vue'
+import i18n from '@/locales'
 
 interface StepData {
   goods_art_no: string
   msg_type: string
   name: string
-  status: '等待处理' | '正在处理' | '处理完成' | '处理失败'
+  status: string
   current: number
   total: number
   error: number
@@ -85,15 +86,20 @@ interface Props {
 
 const props = withDefaults(defineProps<Props>(), {
   progress: 0,
-  message: '正在为您处理,请稍后...',
+  message: '',
   disabledButton: true,
-  buttonText: '处理完毕,点击打开最终图片目录',
+  buttonText: '',
   requesting: false,
   useNewProgress: false,
   progressSteps: () => [],
   onOpenFolder: () => {}
 })
 
+// 使用 i18n 默认值
+const defaultMessage = i18n.global.t('loadingDialog.processing')
+const defaultButtonText = i18n.global.t('loadingDialog.processComplete')
+const allFailedText = i18n.global.t('loadingDialog.allFailed')
+
 const emit = defineEmits<{
   (e: 'update:modelValue', value: boolean): void
   (e: 'button-click'): void

+ 25 - 17
frontend/src/views/Photography/components/ProgressSteps.vue

@@ -9,13 +9,13 @@
       >
         <!-- 步骤圆圈 -->
         <div class="step-circle">
-          <div v-if="step.status === '处理完成'" class="step-icon completed">
+          <div v-if="step.status === tCompleted.value" class="step-icon completed">
             <el-icon><Check /></el-icon>
           </div>
-          <div v-else-if="step.status === '正在处理'" class="step-icon processing">
+          <div v-else-if="step.status === tProcessing.value" class="step-icon processing">
             {{ index + 1 }}
           </div>
-          <div v-else-if="step.status === '处理失败'" class="step-icon failed">
+          <div v-else-if="step.status === tFailed.value" class="step-icon failed">
             <el-icon><Close /></el-icon>
           </div>
           <div v-else class="step-icon waiting">
@@ -28,16 +28,14 @@
           <div class="step-title">{{ step.name }}</div>
           <div class="step-status">
             {{ getStepTitle(step) }}
-            <div v-if="step.status !== '等待处理'" class="step-details">
-              第{{ step.current }}/{{ step.total }}款
+            <div v-if="step.status !== tWaiting.value" class="step-details">
+              {{ tCurrentProgress.value.replace('{current}', step.current).replace('{total}', step.total) }}
               {{ getCurrentGoodsNo(step) }}
-              <span v-if="step.error" style="color: red; margin-left:5px;">失败:{{step.error}}款</span>
-
-
+              <span v-if="step.error" style="color: red; margin-left:5px;">{{ tFailedCount.value.replace('{count}', step.error) }}</span>
             </div>
           </div>
           <div v-if="step.folder" class="step-actions">
-            <span class="view-results" @click="handleViewResults(step)">查看结果</span>
+            <span class="view-results" @click="handleViewResults(step)">{{ tViewResults }}</span>
           </div>
         </div>
 
@@ -55,7 +53,7 @@
         class="completion-button"
         @click="handleComplete"
       >
-        处理完毕,点击打开最终图片目录
+        {{ tProcessComplete }}
       </el-button>
     </div>
   </div>
@@ -64,16 +62,17 @@
 <script setup lang="ts">
 import { ref, computed, watch } from 'vue'
 import { Check, Close } from '@element-plus/icons-vue'
+import i18n from '@/locales'
 
 interface StepData {
   msg_type: string
   goods_art_no: string
   name: string
-  status: '等待处理' | '正在处理' | '处理完成' | '处理失败'
+  status: string
   current: number
   total: number
   error: number
-  folder?: string // 添加folder字段
+  folder?: string
 }
 
 interface Props {
@@ -96,19 +95,28 @@ const emit = defineEmits<{
   (e: 'complete'): void
 }>()
 
+// i18n 翻译
+const tWaiting = computed(() => i18n.global.t('loadingDialog.waiting'))
+const tProcessing = computed(() => i18n.global.t('loadingDialog.processing'))
+const tCompleted = computed(() => i18n.global.t('loadingDialog.completed'))
+const tFailed = computed(() => i18n.global.t('loadingDialog.failed'))
+const tViewResults = computed(() => i18n.global.t('loadingDialog.viewResults'))
+const tProcessComplete = computed(() => i18n.global.t('loadingDialog.processComplete'))
+const tCurrentProgress = computed(() => i18n.global.t('loadingDialog.currentProgress'))
+const tFailedCount = computed(() => i18n.global.t('loadingDialog.failedCount'))
 
 // 获取步骤标题
 const getStepTitle = (step: StepData) => {
-  return  step.status
+  return step.status
 }
 
 // 获取步骤样式类
 const getStepClass = (step: StepData) => {
   return {
-    'step-completed': step.status === '处理完成',
-    'step-processing': step.status === '正在处理',
-    'step-failed': step.status === '处理失败',
-    'step-waiting': step.status === '等待处理'
+    'step-completed': step.status === tCompleted.value,
+    'step-processing': step.status === tProcessing.value,
+    'step-failed': step.status === tFailed.value,
+    'step-waiting': step.status === tWaiting.value
   }
 }
 

+ 1 - 1
frontend/src/views/Photography/detail.vue

@@ -1658,7 +1658,7 @@ const generate = async function () {
       completeDirectory.value = ''
       progress.value = 100
       disabledButton.value = true
-      message.value = '全部货号生成失败'
+      message.value = i18n.global.t('loadingDialog.allFailed')
       requesting.value = false  // 重置请求状态,允许再次生成
 
     }