fix[utils][smartling]: ENG-12274 smartling plugin skips nested fields for translation#4651
fix[utils][smartling]: ENG-12274 smartling plugin skips nested fields for translation#4651AishwaryaParab wants to merge 2 commits into
Conversation
|
|
View your CI Pipeline Execution ↗ for commit d68fc77
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3fe5e6d. Configure here.
anaghav2023
left a comment
There was a problem hiding this comment.
@AishwaryaParab changes look good. I think this is tested on a data model content entry. Better to test this on a normal page model content entry as well

Description
When a data model field has the Localize toggle enabled, Builder stores the entire array as a single LocalizedValue object. The Smartling plugin was not sending the individual string fields inside that array for translation. So, only the parent field was recorded, but as a non-string value that Smartling cannot translate.
Example data structure that was broken:
questionandanswerwere dropped and nothing reached Smartling.Fix:
Updated getTranslateableFields in @builder.io/utils to recursively walk into array/object payloads of a LocalizedValue and extract individual string leaves as separate translation entries:
Also updated applyTranslation to correctly write translated values back into the right position in the locale-specific copy of the array.
Two new unit tests added:
Screenshot
https://www.loom.com/share/e0e1bad23bac408d8ee17619a60bac07
Note
Medium Risk
Changes how localized custom-field content is read and written during translation; mistakes could corrupt locale data, though behavior is covered by new tests and
sourceLocaleIdis optional.Overview
Fixes Smartling/metadata translation when a Localized custom field stores an array or object (e.g. FAQ
items) instead of a single string. Previously only the parent field was exported—often as a non-translatable blob—so nested strings never reached Smartling.getTranslateableFieldsnow walks content metadata with a custom recursive extractor that stops atLocalizedValueboundaries and usesextractNestedStringsto emit one translatable entry per string leaf (e.g.metadata.faqs#items#0#question). Nested object fields under localized SEO now appear as separate keys in snapshots instead of one whole-object entry.applyTranslationgains an optionalsourceLocaleId, matches compound translation keys under eachLocalizedValue, deep-clones the source locale payload (preferringsourceLocaleIdoverDefault), patches leaves (keeping nestedLocalizedValueobjects intact), and stores the result on the target locale.New unit tests cover FAQ extraction/apply-back, double-localized sub-fields, and source-locale structure when it diverges from
Default.Reviewed by Cursor Bugbot for commit d68fc77. Bugbot is set up for automated code reviews on this repo. Configure here.