[plugin][smartling]: ENG-12315 Smartling custom component list field#4555
[plugin][smartling]: ENG-12315 Smartling custom component list field#4555anaghav2023 wants to merge 4 commits into
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 6b2c0f2
☁️ Nx Cloud last updated this comment at |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx test @snippet/react |
❌ Failed | 3m 38s | View ↗ |
nx test @e2e/angular-17 |
✅ Succeeded | 12m 7s | View ↗ |
nx test @e2e/angular-19-ssr |
✅ Succeeded | 8m 53s | View ↗ |
nx test @e2e/qwik-city |
✅ Succeeded | 8m 2s | View ↗ |
nx test @e2e/remix |
✅ Succeeded | 8m 1s | View ↗ |
nx test @e2e/solid-start |
✅ Succeeded | 8m 2s | View ↗ |
nx test @e2e/vue |
✅ Succeeded | 6m 53s | View ↗ |
nx test @e2e/nextjs-sdk-next-app |
✅ Succeeded | 7m 1s | View ↗ |
Additional runs (38) |
✅ Succeeded | ... | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-05-07 13:52:07 UTC
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 07fdf6b. Configure here.
| const localeValue = JSON.parse(JSON.stringify(inputValue?.Default ?? [])); | ||
| subEntries.forEach(([k, entry]) => { | ||
| const subPath = k.slice(exactKey.length); | ||
| set(localeValue, subPath, unescapeStringOrObject(entry.value)); |
There was a problem hiding this comment.
Leading dot in subPath corrupts object translation placement
Medium Severity
When extractStringLeaves processes object properties, it builds paths like basePath.key. During reconstruction, subPath = k.slice(exactKey.length) produces a string starting with . (e.g., .key1). Lodash's set interprets a leading dot as path ['', 'key1'], so it creates localeValue['']['key1'] instead of localeValue['key1']. This silently places translated values under a spurious empty-string key, corrupting the output for object-type LocalizedValues in custom components. Array-type values (paths starting with [) are unaffected.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 07fdf6b. Configure here.
| if (typeof value === 'string') { | ||
| results[path] = { value, instructions }; | ||
| } else if (value?.['@type'] === localizedType) { | ||
| extractStringLeaves(value.Default, path, results, instructions); |
There was a problem hiding this comment.
Nested LocalizedValues always use Default, ignoring source locale
Low Severity
extractStringLeaves doesn't accept a sourceLocaleId parameter. When it encounters a nested LocalizedValue inside a list or object, it always extracts value.Default (line 106) instead of preferring value[sourceLocaleId]. This is inconsistent with recordValue (used for Symbols), which correctly checks sourceLocaleId first. If nested LocalizedValues have different text for the source locale vs Default, the wrong source text gets sent for translation.
Reviewed by Cursor Bugbot for commit 07fdf6b. Configure here.



Description
Currently, if we have fields of type 'list' in a custom component, then they don't get translated in smartling. This PR fixes the issue.
Issue:https://www.loom.com/share/30f2aa1ca4e840539a7bac796b79bd85
Fix: https://www.loom.com/share/422f8147f69d46e4bc7b939b5bcb85df
Note
Medium Risk
Medium risk because it changes how translation keys are extracted and applied for localized custom component inputs, including reconstructing nested list/object values from leaf paths; mistakes could lead to missing or misapplied translations.
Overview
Fixes Smartling translations for custom component localized inputs whose values are lists/objects (not just strings).
getTranslateableFieldsnow flattens nested structures into per-leaf translation keys viaextractStringLeaves, andapplyTranslationcan reconstruct the locale value by stitching translated leaf paths back into theDefaultstructure; string inputs keep the prior direct behavior.Bumps versions (
@builder.io/utilsto1.1.30-0, Smartling plugin to0.1.1-0) and updates the Smartling plugin to depend on the new utils prerelease.Reviewed by Cursor Bugbot for commit 6b2c0f2. Bugbot is set up for automated code reviews on this repo. Configure here.