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,13 +1,17 @@
|
||||
/**
|
||||
* features/chat/shipping/shippingMapping.ts
|
||||
* 用途:库存列映射消息 payload 读取与字段对齐 Markdown 生成。
|
||||
* 依赖:shippingText.normalizeShippingHeaderForDisplay、chat.types、shipping.types。
|
||||
* 依赖:shippingText.normalizeShippingHeaderForDisplay、chat.types、shipping.types、vue-i18n。
|
||||
* 逻辑:ShippingInventoryMappingMessage 与 useChatShippingMappingForm 读取 mapping 消息数据。
|
||||
*/
|
||||
import i18n from '@/i18n';
|
||||
import { normalizeShippingHeaderForDisplay } from './shippingText';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
import type { ShippingInventoryMappingFormPayload } from '../types/shipping.types';
|
||||
|
||||
const tt = (key: string, params?: Record<string, unknown>) =>
|
||||
String(params ? i18n.global.t(key, params) : i18n.global.t(key));
|
||||
|
||||
/**
|
||||
* 从 shipping-inventory-mapping 类型消息中提取 taskId、schema_preview 与 form。
|
||||
*/
|
||||
@@ -41,14 +45,16 @@ export function buildShippingFieldAlignmentText(payload: { data?: { field_alignm
|
||||
const invCols = (alignment as { inventory_columns?: { mapping?: Record<string, { source_column?: string }> } }).inventory_columns || {};
|
||||
const mapping = invCols.mapping || {};
|
||||
const rows: Array<[string, string]> = [
|
||||
['sku', normalizeShippingHeaderForDisplay(mapping?.sku?.source_column) || '(未识别)'],
|
||||
['reservation_id', normalizeShippingHeaderForDisplay(mapping?.reservation_id?.source_column) || '(未识别/可选)'],
|
||||
['available_qty', normalizeShippingHeaderForDisplay(mapping?.available_qty?.source_column) || '(未识别)'],
|
||||
['sku', normalizeShippingHeaderForDisplay(mapping?.sku?.source_column) || tt('chat.shippingNoticeFieldAlignment.unrecognized')],
|
||||
['reservation_id', normalizeShippingHeaderForDisplay(mapping?.reservation_id?.source_column) || tt('chat.shippingNoticeFieldAlignment.unrecognizedOptional')],
|
||||
['available_qty', normalizeShippingHeaderForDisplay(mapping?.available_qty?.source_column) || tt('chat.shippingNoticeFieldAlignment.unrecognized')],
|
||||
];
|
||||
const lines: string[] = [];
|
||||
const matchRule = String((alignment as { match_rule?: string }).match_rule || '').trim();
|
||||
if (matchRule) lines.push(`匹配规则:${matchRule}`);
|
||||
lines.push('', '字段对齐表:', '', '|系统字段|库存列|', '|---|---|');
|
||||
if (matchRule) lines.push(tt('chat.shippingNoticeFieldAlignment.matchRule', { rule: matchRule }));
|
||||
const sys = tt('chat.shippingNoticeFieldAlignment.tableHeaderSystem');
|
||||
const inv = tt('chat.shippingNoticeFieldAlignment.tableHeaderInventory');
|
||||
lines.push('', tt('chat.shippingNoticeFieldAlignment.tableTitle'), '', `|${sys}|${inv}|`, '|---|---|');
|
||||
for (const [k, v] of rows) {
|
||||
lines.push(`|${k}|${v}|`);
|
||||
}
|
||||
@@ -56,7 +62,7 @@ export function buildShippingFieldAlignmentText(payload: { data?: { field_alignm
|
||||
? (alignment as { warnings: unknown[] }).warnings.filter(Boolean)
|
||||
: [];
|
||||
if (warnings.length) {
|
||||
lines.push('', '提示:', ...warnings.map((w) => `- ${String(w)}`));
|
||||
lines.push('', tt('chat.shippingNoticeFieldAlignment.hints'), ...warnings.map((w) => `- ${String(w)}`));
|
||||
}
|
||||
return lines.join('\n').trim();
|
||||
}
|
||||
Reference in new issue
Block a user