Skip to content

Commit d10ac73

Browse files
committed
feat(spec): model action-param translations in TranslationData (_actions.params)
Action labels localize via `objects.<obj>._actions.<action>.label` bundle keys, but action PARAMS (the dialog form fields) had no translation path — the `_actions` translation schema only modeled label/confirmText/successMessage, so a param's label/helpText/placeholder/options could not be localized and rendered English in a zh UI. Add an optional `params` record to the action translation schema (in ObjectTranslationDataSchema._actions, globalActions, and the secondary ObjectTranslationNodeSchema._actions): _actions.<action>.params.<param>.{ label?, helpText?, placeholder?, options? } `options` maps a select value → translated label. All optional and additive, so existing bundles are unaffected. objectui's `useObjectLabel().actionParamText()` already reads this exact key path; this unblocks authoring the bundle entries. Tests: 1149 spec tests pass (translation/i18n-resolver/typegen); DTS build green.
1 parent f3d1069 commit d10ac73

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ export const ObjectTranslationDataSchema = lazySchema(() => z.object({
7979
label: z.string().optional().describe('Translated action label'),
8080
confirmText: z.string().optional().describe('Translated confirmation prompt'),
8181
successMessage: z.string().optional().describe('Translated success toast/message'),
82+
params: z.record(z.string(), z.object({
83+
label: z.string().optional().describe('Translated action parameter label'),
84+
helpText: z.string().optional().describe('Translated action parameter help/hint text'),
85+
placeholder: z.string().optional().describe('Translated action parameter placeholder'),
86+
options: z.record(z.string(), z.string()).optional().describe('Param select option value to translated label'),
87+
})).optional().describe('Action parameter translations keyed by parameter name'),
8288
})).optional().describe('Action translations keyed by action name'),
8389

8490
/**
@@ -145,6 +151,12 @@ export const TranslationDataSchema = lazySchema(() => z.object({
145151
label: z.string().optional().describe('Translated action label'),
146152
confirmText: z.string().optional().describe('Translated confirmation prompt'),
147153
successMessage: z.string().optional().describe('Translated success toast/message'),
154+
params: z.record(z.string(), z.object({
155+
label: z.string().optional().describe('Translated action parameter label'),
156+
helpText: z.string().optional().describe('Translated action parameter help/hint text'),
157+
placeholder: z.string().optional().describe('Translated action parameter placeholder'),
158+
options: z.record(z.string(), z.string()).optional().describe('Param select option value to translated label'),
159+
})).optional().describe('Action parameter translations keyed by parameter name'),
148160
})).optional().describe('Global action translations keyed by action name'),
149161

150162
/**
@@ -466,6 +478,12 @@ export const ObjectTranslationNodeSchema = lazySchema(() => z.object({
466478
_actions: z.record(z.string(), z.object({
467479
label: z.string().optional().describe('Translated action label'),
468480
confirmMessage: z.string().optional().describe('Translated confirmation message'),
481+
params: z.record(z.string(), z.object({
482+
label: z.string().optional().describe('Translated action parameter label'),
483+
helpText: z.string().optional().describe('Translated action parameter help/hint text'),
484+
placeholder: z.string().optional().describe('Translated action parameter placeholder'),
485+
options: z.record(z.string(), z.string()).optional().describe('Param select option value to translated label'),
486+
})).optional().describe('Action parameter translations keyed by parameter name'),
469487
})).optional().describe('Action translations keyed by action name'),
470488

471489
/** Notification message translations keyed by notification name */

0 commit comments

Comments
 (0)