feat(i18n): 将前端用户可见中文硬编码改为四语言
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dce915ea30
commit
ac7b53a523
105 files changed
+2928
-647
No files matched your search
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* features/chat/shipping/shippingTurnActions.ts
|
||||
* 用途:将发货通知菜单/决策 action.id 映射为 Chat Turn action_type + payload。
|
||||
* 依赖:constants/shipping。
|
||||
* 依赖:constants/shipping、vue-i18n(displayText)。
|
||||
* 逻辑:useChatShippingDecision 与 useChatShippingMenuHandler 调用本模块,不再直调 workspace API 插消息。
|
||||
*/
|
||||
import i18n from '@/i18n';
|
||||
import { SHIPPING_DECISION_ACTIONS } from '../constants/shipping';
|
||||
|
||||
export interface ShippingChatTurnSpec {
|
||||
@@ -11,6 +12,9 @@ export interface ShippingChatTurnSpec {
|
||||
payload: Record<string, unknown>;
|
||||
}
|
||||
|
||||
const tt = (key: string, params?: Record<string, unknown>) =>
|
||||
String(params ? i18n.global.t(key, params) : i18n.global.t(key));
|
||||
|
||||
/**
|
||||
* 将发货 UI 动作 id 解析为平台 Chat Turn 规格。
|
||||
* @param actionId - 状态机 action_buttons.id
|
||||
@@ -72,6 +76,7 @@ export function buildShippingSubmitDecisionTurn(
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造发货通知建批 Chat Turn(multipart 上传)。
|
||||
*/
|
||||
@@ -82,8 +87,10 @@ export function buildShippingCreateBatchTurn(
|
||||
): { actionType: string; displayText: string; payload: Record<string, unknown>; files: File[] } {
|
||||
const count = files.length;
|
||||
const displayText = count === 1
|
||||
? `上传发货通知:${files[0]?.name || '附件'}`
|
||||
: `上传 ${count} 份发货通知`;
|
||||
? tt('chat.shippingNoticeTurn.createBatchSingle', {
|
||||
fileName: files[0]?.name || tt('chat.shippingNoticeTurn.attachmentFallback'),
|
||||
})
|
||||
: tt('chat.shippingNoticeTurn.createBatchMulti', { count });
|
||||
return {
|
||||
actionType: 'shipping.create_batch_from_notices',
|
||||
displayText,
|
||||
@@ -106,8 +113,8 @@ export function buildShippingCreateBatchFromIntakesTurn(
|
||||
): { actionType: string; displayText: string; payload: Record<string, unknown> } {
|
||||
const count = intakeNos.length;
|
||||
const displayText = count === 1
|
||||
? `确认建单:${intakeNos[0]}`
|
||||
: `确认建单:${count} 份发货通知`;
|
||||
? tt('chat.shippingNoticeTurn.confirmBatchSingle', { intakeNo: intakeNos[0] })
|
||||
: tt('chat.shippingNoticeTurn.confirmBatchMulti', { count });
|
||||
return {
|
||||
actionType: 'shipping.create_batch_from_intakes',
|
||||
displayText,
|
||||
@@ -131,33 +138,42 @@ export function buildShippingTurnRefs(taskNo: string, batchNo?: string): Record<
|
||||
return refs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造库存上传 Chat Turn。
|
||||
*/
|
||||
export function buildShippingUploadInventoryTurn(taskNo: string, file: File) {
|
||||
const task = String(taskNo || '').trim().toUpperCase();
|
||||
return {
|
||||
actionType: 'shipping.upload_inventory',
|
||||
displayText: `上传库存文件:${file.name}`,
|
||||
displayText: tt('chat.shippingNoticeTurn.uploadInventory', { fileName: file.name }),
|
||||
payload: { task_no: task },
|
||||
files: [file],
|
||||
refs: buildShippingTurnRefs(task),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造重新上传发货通知 Chat Turn。
|
||||
*/
|
||||
export function buildShippingReplaceNoticeTurn(taskNo: string, file: File) {
|
||||
const task = String(taskNo || '').trim().toUpperCase();
|
||||
return {
|
||||
actionType: 'shipping.replace_notice',
|
||||
displayText: `重新上传发货通知:${file.name}`,
|
||||
displayText: tt('chat.shippingNoticeTurn.replaceNotice', { fileName: file.name }),
|
||||
payload: { task_no: task },
|
||||
files: [file],
|
||||
refs: buildShippingTurnRefs(task),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造应用库存列映射 Chat Turn。
|
||||
*/
|
||||
export function buildShippingApplyMappingTurn(taskNo: string, mapping: Record<string, string>) {
|
||||
const task = String(taskNo || '').trim().toUpperCase();
|
||||
return {
|
||||
actionType: 'shipping.apply_inventory_mapping',
|
||||
displayText: `应用库存列映射(任务 ${task})`,
|
||||
displayText: tt('chat.shippingNoticeTurn.applyMapping', { taskId: task }),
|
||||
payload: { task_no: task, map_json: mapping },
|
||||
refs: buildShippingTurnRefs(task),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user