fix(mcp): las traducciones de vars de modulo van por NOMBRE de var, no columna fisica
Una sesion real del agente guardo title3/title6/title2 (columnas de builder_custom segun varsMeta.fieldName, como decian las docs) y el front no pintaba nada: el runtime traduce vars con t($record, $var) por nombre de var. Corregidas descripciones de set/get_record_translations, docs 03/09/11b y ACAI_ENDPOINTS; ademas el puente PHP ahora rechaza titleN/ textN sobre builder_custom con error explicativo (guardrail).
This commit is contained in:
@@ -389,7 +389,7 @@ Notas: `prefix === "www"` es el idioma base (URLs sin prefijo, `urlPrefix === ""
|
||||
Notas:
|
||||
- Solo campos traducibles: `textfield`, `textbox`, `wysiwyg`, `codigo`, `multitext` (el multitext se traduce como el JSON serializado completo en una fila).
|
||||
- Un `fieldValue` vacío (`''`) borra la traducción y el runtime cae al idioma base.
|
||||
- Vars de módulo: usar `tableName: 'builder_custom'` + el `recordNum`/`fieldName` que da `varsMeta` de `get_module_config_vars`.
|
||||
- Vars de módulo: `tableName: 'builder_custom'` + `recordNum` de `varsMeta` (`get_module_config_vars`), pero el fieldName es el NOMBRE DE LA VAR del builder.json (`titulo`, `subtitulo`, `enlace_anchor`...), nunca la columna física `titleN`/`textN` (la action la rechaza con 400).
|
||||
- Lectura traducida en línea: las tools `list_table_records`/`get_record` pasan `options.translates = <prefix>` al `cmsApi` get (equivalente al header `X-ACAI-ACCEPT-LANGUAGE` en cms_api v3).
|
||||
|
||||
## Patrones Comunes
|
||||
|
||||
@@ -19,7 +19,7 @@ Params:
|
||||
|
||||
Returns translations shaped as { "<recordNum>": { "<prefix>": { "<fieldName>": "<value>" } } }.
|
||||
|
||||
To translate module vars, first call get_module_config_vars to obtain varsMeta ({ fieldName, recordNum } per var) and read from tableName='builder_custom'. For template literals, read tableName='textos_generales' field 'texto'.`,
|
||||
To read module var translations, call get_module_config_vars for the recordNum (varsMeta) and read tableName='builder_custom' — rows are keyed by VAR NAME ('titulo', 'subtitulo'...), not by physical column (title3). For template literals, read tableName='textos_generales' field 'texto'.`,
|
||||
withAuthParams({
|
||||
tableName: z.string().describe("Table name without 'cms_' prefix (e.g. 'apartados', 'builder_custom', 'textos_generales')"),
|
||||
recordNums: z.array(z.number()).describe("Array of record 'num' primary keys to read translations for"),
|
||||
|
||||
@@ -13,7 +13,7 @@ Four usage scenarios:
|
||||
1. Normal records — translate the visible text fields of any content table. tableName without 'cms_', recordNum = the record 'num', fields = { fieldName: translatedText }.
|
||||
2. configuracion / configuracion_tienda — the global settings tables are ordinary records; translate their text fields the same way (locate the row with list_table_records).
|
||||
3. textos_generales — the template literals used by the Twig '| translate' filter are normal records: translate their 'texto' field. Find the right num by 'identificador' with list_table_records first (tableName='textos_generales', fields={ texto: '...' }).
|
||||
4. Module vars — the textual values of a module live in the 'builder_custom' table. Call get_module_config_vars to get varsMeta ({ fieldName, recordNum } per var, and per item for multi vars), then set tableName='builder_custom', recordNum + fields={ <fieldName>: translatedText } from varsMeta.
|
||||
4. Module vars — the textual values of a module live in the 'builder_custom' table. Call get_module_config_vars to get varsMeta and use its recordNum, BUT the field key MUST be the VAR NAME from builder.json (e.g. 'titulo', 'subtitulo', 'enlace_anchor') — NEVER the physical column (title3, text1...): the engine translates module vars by var name and physical columns are rejected. Example: set tableName='builder_custom', recordNum=<varsMeta recordNum>, fields={ titulo: 'Translated title' }.
|
||||
|
||||
Rules:
|
||||
- An EMPTY STRING ('') as a value DELETES that translation (falls back to base language at runtime).
|
||||
|
||||
Reference in New Issue
Block a user