From 5203b991de13e0825b014d05a11dffe2dd1619d5 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Tue, 21 Oct 2025 17:42:02 +0800 Subject: [PATCH] feat: add i18n --- .../components/conversation/ConversationList.vue | 3 ++- .../detail/modules/operation-button.vue | 13 +++++++------ .../iot/device/device/modules/DeviceImportForm.vue | 5 +++-- .../src/views/mall/product/comment/index.vue | 2 +- apps/web-antd/src/views/mall/product/spu/index.vue | 2 +- .../mall/product/spu/modules/product-attributes.vue | 6 +++--- .../views/mall/promotion/seckill/config/index.vue | 2 +- .../mall/statistics/trade/modules/trend-card.vue | 2 +- .../src/views/mall/product/comment/index.vue | 2 +- apps/web-ele/src/views/mall/product/spu/index.vue | 2 +- .../views/mall/promotion/seckill/config/index.vue | 2 +- .../statistics/product/modules/summary-card.vue | 2 +- .../mall/statistics/trade/modules/trend-card.vue | 9 ++++++--- 13 files changed, 29 insertions(+), 23 deletions(-) diff --git a/apps/web-antd/src/views/ai/chat/index/components/conversation/ConversationList.vue b/apps/web-antd/src/views/ai/chat/index/components/conversation/ConversationList.vue index 08348f79c..c0f79bebb 100644 --- a/apps/web-antd/src/views/ai/chat/index/components/conversation/ConversationList.vue +++ b/apps/web-antd/src/views/ai/chat/index/components/conversation/ConversationList.vue @@ -17,6 +17,7 @@ import { getChatConversationMyList, updateChatConversationMy, } from '#/api/ai/chat/conversation'; +import { $t } from '#/locales'; import RoleRepository from '../role/RoleRepository.vue'; @@ -249,7 +250,7 @@ async function handleClearConversation() { try { await confirm('确认后对话会全部清空,置顶的对话除外。'); await deleteChatConversationMyByUnpinned(); - message.success('操作成功!'); + message.success($t('ui.actionMessage.operationSuccess')); // 清空 对话 和 对话内容 activeConversationId.value = null; // 获取 对话列表 diff --git a/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue b/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue index 11205ce7e..4a3b704e6 100644 --- a/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue +++ b/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue @@ -44,6 +44,7 @@ import { import * as TaskApi from '#/api/bpm/task'; import * as UserApi from '#/api/system/user'; import { setConfAndFields2 } from '#/components/form-create'; +import { $t } from '#/locales'; import Signature from './signature.vue'; import ProcessInstanceTimeline from './time-line.vue'; @@ -426,7 +427,7 @@ async function handleCopy() { await TaskApi.copyTask(data); copyFormRef.value.resetFields(); popOverVisible.value.copy = false; - message.success('操作成功'); + message.success($t('ui.actionMessage.operationSuccess')); } finally { formLoading.value = false; } @@ -448,7 +449,7 @@ async function handleTransfer() { await TaskApi.transferTask(data); transferFormRef.value.resetFields(); popOverVisible.value.transfer = false; - message.success('操作成功'); + message.success($t('ui.actionMessage.operationSuccess')); // 2. 加载最新数据 reload(); } finally { @@ -473,7 +474,7 @@ async function handleDelegate() { await TaskApi.delegateTask(data); popOverVisible.value.delegate = false; delegateFormRef.value.resetFields(); - message.success('操作成功'); + message.success($t('ui.actionMessage.operationSuccess')); // 2. 加载最新数据 reload(); } finally { @@ -496,7 +497,7 @@ async function handlerAddSign(type: string) { userIds: addSignForm.addSignUserIds, }; await TaskApi.signCreateTask(data); - message.success('操作成功'); + message.success($t('ui.actionMessage.operationSuccess')); addSignFormRef.value.resetFields(); popOverVisible.value.addSign = false; // 2 加载最新数据 @@ -523,7 +524,7 @@ async function handleReturn() { await TaskApi.returnTask(data); popOverVisible.value.return = false; returnFormRef.value.resetFields(); - message.success('操作成功'); + message.success($t('ui.actionMessage.operationSuccess')); // 2 重新加载数据 reload(); } finally { @@ -544,7 +545,7 @@ async function handleCancel() { cancelForm.cancelReason, ); popOverVisible.value.return = false; - message.success('操作成功'); + message.success($t('ui.actionMessage.operationSuccess')); cancelFormRef.value.resetFields(); // 2 重新加载数据 reload(); diff --git a/apps/web-antd/src/views/iot/device/device/modules/DeviceImportForm.vue b/apps/web-antd/src/views/iot/device/device/modules/DeviceImportForm.vue index 04d674a5e..c891708a5 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/DeviceImportForm.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/DeviceImportForm.vue @@ -7,6 +7,7 @@ import { downloadFileFromBlobPart } from '@vben/utils'; import { message } from 'ant-design-vue'; import { importDeviceTemplate } from '#/api/iot/device/device'; +import { $t } from '#/locales'; import { useImportFormSchema } from '../data'; @@ -64,7 +65,7 @@ const [Modal, modalApi] = useVbenModal({ const result = await response.json(); if (result.code !== 0) { - message.error(result.msg || '导入失败'); + message.error(result.msg || $t('ui.actionMessage.operationFailed')); return; } @@ -94,7 +95,7 @@ const [Modal, modalApi] = useVbenModal({ await modalApi.close(); emit('success'); } catch (error: any) { - message.error(error.message || '导入失败'); + message.error(error.message || $t('ui.actionMessage.operationFailed')); } finally { modalApi.unlock(); } diff --git a/apps/web-antd/src/views/mall/product/comment/index.vue b/apps/web-antd/src/views/mall/product/comment/index.vue index cbae411d4..c9311af7d 100644 --- a/apps/web-antd/src/views/mall/product/comment/index.vue +++ b/apps/web-antd/src/views/mall/product/comment/index.vue @@ -79,7 +79,7 @@ async function handleStatusChange( message.success(`${text}成功`); resolve(true); } else { - reject(new Error('操作失败')); + reject(new Error($t('ui.actionMessage.operationFailed'))); } }) .catch(() => { diff --git a/apps/web-antd/src/views/mall/product/spu/index.vue b/apps/web-antd/src/views/mall/product/spu/index.vue index 2d24ef471..0fb793718 100644 --- a/apps/web-antd/src/views/mall/product/spu/index.vue +++ b/apps/web-antd/src/views/mall/product/spu/index.vue @@ -155,7 +155,7 @@ async function handleStatusChange( message.success(`${text}成功`); resolve(true); } else { - reject(new Error('操作失败')); + reject(new Error($t('ui.actionMessage.operationFailed'))); } }) .catch(() => { diff --git a/apps/web-antd/src/views/mall/product/spu/modules/product-attributes.vue b/apps/web-antd/src/views/mall/product/spu/modules/product-attributes.vue index f54bf3c51..89786800f 100644 --- a/apps/web-antd/src/views/mall/product/spu/modules/product-attributes.vue +++ b/apps/web-antd/src/views/mall/product/spu/modules/product-attributes.vue @@ -97,7 +97,7 @@ const showInput = async (index: number) => { const handleInputConfirm = async (index: number, propertyId: number) => { // 从数组中取最后一个输入的值(tags 模式下 inputValue 是数组) const currentValue = inputValue.value?.[inputValue.value.length - 1]?.trim(); - + if (currentValue) { // 1. 重复添加校验 if ( @@ -136,10 +136,10 @@ const handleInputConfirm = async (index: number, propertyId: number) => { id, name: currentValue, }); - message.success($t('common.createSuccess')); + message.success($t('ui.actionMessage.operationSuccess')); emit('success', attributeList.value); } catch { - message.error('添加失败,请重试'); + message.error($t('ui.actionMessage.operationFailed')); } } attributeIndex.value = null; diff --git a/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue b/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue index c598fdcff..185162a8a 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue +++ b/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue @@ -73,7 +73,7 @@ async function handleStatusChange( message.success(`${text}成功`); resolve(true); } else { - reject(new Error('操作失败')); + reject(new Error($t('ui.actionMessage.operationFailed'))); } }) .catch(() => { diff --git a/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue b/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue index 47c5afc1a..78117cde7 100644 --- a/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue +++ b/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue @@ -125,7 +125,7 @@ async function handleExport() { - 导出 + {{ $t('page.action.export') }} diff --git a/apps/web-ele/src/views/mall/product/comment/index.vue b/apps/web-ele/src/views/mall/product/comment/index.vue index 7d37b78e9..3297dd47a 100644 --- a/apps/web-ele/src/views/mall/product/comment/index.vue +++ b/apps/web-ele/src/views/mall/product/comment/index.vue @@ -80,7 +80,7 @@ async function handleStatusChange( ElMessage.success(`${text}成功`); resolve(true); } else { - reject(new Error('操作失败')); + reject(new Error($t('ui.actionMessage.operationFailed'))); } }) .catch(() => { diff --git a/apps/web-ele/src/views/mall/product/spu/index.vue b/apps/web-ele/src/views/mall/product/spu/index.vue index 6ed935273..101fb3b2a 100644 --- a/apps/web-ele/src/views/mall/product/spu/index.vue +++ b/apps/web-ele/src/views/mall/product/spu/index.vue @@ -145,7 +145,7 @@ async function handleStatusChange( ElMessage.success(`${text}成功`); resolve(true); } else { - reject(new Error('操作失败')); + reject(new Error($t('ui.actionMessage.operationFailed'))); } }) .catch(() => { diff --git a/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue b/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue index de69c864e..3cd551129 100644 --- a/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue +++ b/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue @@ -70,7 +70,7 @@ async function handleStatusChange( ElMessage.success(`${text}成功`); resolve(true); } else { - reject(new Error('操作失败')); + reject(new Error($t('ui.actionMessage.operationFailed'))); } }) .catch(() => { diff --git a/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue b/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue index 5cdfac208..38b174e81 100644 --- a/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue +++ b/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue @@ -133,7 +133,7 @@ async function handleExport() { - 导出 + {{ $t('page.action.export') }} diff --git a/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue b/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue index 1c6090858..0e5df93a5 100644 --- a/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue +++ b/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue @@ -18,8 +18,8 @@ import { isSameDay, } from '@vben/utils'; -import { ElButton, ElCard, ElCol, ElRow } from 'element-plus'; import dayjs from 'dayjs'; +import { ElButton, ElCard, ElCol, ElRow } from 'element-plus'; import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; @@ -123,7 +123,11 @@ async function handleExport() {
- + @@ -279,4 +283,3 @@ async function handleExport() {
-