Skip to content

Commit f1fa9a7

Browse files
committed
feat: add dashboard translation schema and CRM dashboard widget labels
1 parent 60e6ac4 commit f1fa9a7

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

examples/app-crm/src/translations/zh-CN.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,15 @@ export const zhCN: TranslationData = {
359359
export_dashboard_pdf: { label: '导出' },
360360
},
361361
widgets: {
362-
total_pipeline: { title: '管道总额', description: '所有进行中商机金额合计' },
362+
total_pipeline_value: { title: '管道总额', description: '所有进行中商机金额合计' },
363363
closed_won_qtd: { title: '本季度已成交', description: '本季度已赢得的收入' },
364364
open_opportunities: { title: '进行中商机', description: '正在推进的活跃商机' },
365365
avg_deal_size: { title: '平均订单金额', description: '本季度已成交商机的平均金额' },
366+
pipeline_by_stage: { title: '阶段管道分布', description: '按阶段统计的进行中商机金额' },
367+
monthly_revenue_trend: { title: '月度收入趋势', description: '过去 12 个月的已成交收入' },
368+
opportunities_by_owner: { title: '负责人商机分布', description: '各销售负责的进行中商机' },
369+
lead_source_breakdown: { title: '线索来源分布', description: '按来源统计的线索数量' },
370+
top_opportunities: { title: '重点商机', description: '当前金额最高的进行中商机' },
366371
},
367372
},
368373
},

packages/spec/src/system/translation.zod.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,27 @@ export const TranslationDataSchema = lazySchema(() => z.object({
9191

9292
/** Validation Error Messages */
9393
validationMessages: z.record(z.string(), z.string()).optional().describe('Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})'),
94+
95+
/**
96+
* Dashboard translations keyed by dashboard name.
97+
* Convention (auto-resolved by ObjectUI's `useObjectLabel`):
98+
* dashboards.<name>.label
99+
* dashboards.<name>.description
100+
* dashboards.<name>.actions.<actionUrl>.label
101+
* dashboards.<name>.widgets.<widgetId>.title
102+
* dashboards.<name>.widgets.<widgetId>.description
103+
*/
104+
dashboards: z.record(z.string(), z.object({
105+
label: z.string().optional().describe('Translated dashboard title'),
106+
description: z.string().optional().describe('Translated dashboard description'),
107+
actions: z.record(z.string(), z.object({
108+
label: z.string().optional().describe('Translated header action label'),
109+
})).optional().describe('Header action label translations keyed by action url/key'),
110+
widgets: z.record(z.string(), z.object({
111+
title: z.string().optional().describe('Translated widget title'),
112+
description: z.string().optional().describe('Translated widget description'),
113+
})).optional().describe('Widget translations keyed by widget id'),
114+
})).optional().describe('Dashboard translations keyed by dashboard name'),
94115
}).describe('Translation data for objects, apps, and UI messages'));
95116

96117
export type TranslationData = z.infer<typeof TranslationDataSchema>;

0 commit comments

Comments
 (0)