Translation template
translation_templateGenerate a per-language translation overlay for a Formhaus form definition, translate only its values, and pass it to simulation to verify the result.
Instructions
Call this when the form needs another language, once per language: it returns the overlay to translate, which simulate_path accepts as overlay to check the result. Returns the translation skeleton of a definition for one language: overlay is nested JSON with the source texts as values and a locale key, which the app passes as the locale prop, file is the suggested name (signup.ru.json), slots lists every text with its address, translation key, {placeholders} and a source hash. Translate only the values, keep nesting, identifiers and {placeholders}, then save the overlay next to the definition. Store revision and review state separately; the template never marks anything as translated. When the app has its own keys, such as Lokalise keys, put them in "i18n" objects of the definition exactly as given instead. When the definition has errors, returns ok: false and the validation issues.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"definition": "<definition>",
"lang": "<lang>"
},
"name": "translation_template"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | Yes | Target language code, such as "ru" or "pt-BR". It names the suggested file, such as signup.ru.json. | |
| prefix | No | Prefix of derived translation keys, such as "signup" for keys like signup.title. Defaults to the form id. Pass false to list only the explicit keys from i18n objects. | |
| catalog | No | Locale catalog the app passes as locale, such as the contents of @formhaus/core/locales/ru.json. Its messages and labels are left out of the overlay; catalog in the result lists its missing and unknown keys. | |
| definition | Yes | Formhaus form definition as a JSON object or a JSON string. JSON Schema: https://formhaus.dev/schema/form-definition.json. Top level: id, title, submit { label }, and fields (one step) or steps [{ id, title, fields }]. Field: { key, type, label, validation?, options?, show?, showAny? }. Rules go inside "validation": { required, minLength, maxLength, min, max, pattern, matchField }. Condition: { field, eq | neq | in | notIn | contains | notContains | notEmpty | gt | gte | lt | lte } with exactly one operator, on a field of the same or an earlier step. Optional: lang, messages and labels catalogs, and i18n objects that map texts to translation keys. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| file | No | Suggested file name, such as signup.ru.json. | |
| lang | No | ||
| slots | No | ||
| catalog | No | Keys the given catalog lacks or does not know. Messages and labels it covers are left out of overlay and slots. | |
| overlay | No | Translation skeleton with the source texts as values. Replace the values, keep the nesting. | |
| validation | Yes |