-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Test PR #4257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test PR #4257
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -220,27 +220,8 @@ export function getTranslateableFields( | |
|
|
||
| // blocks | ||
| if (blocks) { | ||
| // Track how many levels deep we are inside excluded blocks | ||
| let excludedDepth = 0; | ||
|
|
||
| traverse(blocks).forEach(function (el) { | ||
| // Check if this element starts an exclusion zone | ||
| const startsExclusion = el && el.meta?.excludeFromTranslation; | ||
| if (startsExclusion) { | ||
| excludedDepth++; | ||
| } | ||
|
|
||
| // After processing children, decrement the counter if this element started an exclusion | ||
| this.after(function () { | ||
| if (startsExclusion) { | ||
| excludedDepth--; | ||
| } | ||
| }); | ||
|
|
||
| // Skip translation if we're inside an excluded block (excludedDepth > 0) | ||
| const isExcluded = excludedDepth > 0; | ||
|
|
||
| if (this.key && el && el.meta?.localizedTextInputs && !isExcluded) { | ||
| if (this.key && el && el.meta?.localizedTextInputs) { | ||
| const localizedTextInputs = el.meta.localizedTextInputs as string[]; | ||
| if (localizedTextInputs && Array.isArray(localizedTextInputs)) { | ||
| localizedTextInputs | ||
|
|
@@ -257,7 +238,7 @@ export function getTranslateableFields( | |
| }); | ||
| } | ||
| } | ||
| if (el && el.id && el.component?.name === 'Text' && !isExcluded) { | ||
| if (el && el.id && el.component?.name === 'Text' && !el.meta?.excludeFromTranslation) { | ||
| const componentText = el.component.options.text; | ||
| results[`blocks.${el.id}#text`] = { | ||
| value: | ||
|
|
@@ -268,7 +249,7 @@ export function getTranslateableFields( | |
| }; | ||
| } | ||
|
|
||
| if (el && el.id && el.component?.name === 'Core:Button' && !isExcluded) { | ||
| if (el && el.id && el.component?.name === 'Core:Button' && !el.meta?.excludeFromTranslation) { | ||
| const componentText = el.component.options?.text; | ||
| if (componentText) { | ||
| const textValue = typeof componentText === 'string' | ||
|
|
@@ -283,7 +264,7 @@ export function getTranslateableFields( | |
| } | ||
| } | ||
|
|
||
| if (el && el.id && el.component?.name === 'Symbol'&& !isExcluded) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nested blocks ignore parent's translation exclusion settingHigh Severity The hierarchical Additional Locations (1) |
||
| if (el && el.id && el.component?.name === 'Symbol') { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Symbol and custom components ignore exclusion entirelyMedium Severity The Additional Locations (1) |
||
| const symbolInputs = Object.entries(el.component?.options?.symbol?.data) || []; | ||
| if (symbolInputs.length) { | ||
| const basePath = `blocks.${el.id}.symbolInput`; | ||
|
|
@@ -335,27 +316,8 @@ export function applyTranslation( | |
| } | ||
|
|
||
| if (blocks) { | ||
| // Track how many levels deep we are inside excluded blocks | ||
| let excludedDepth = 0; | ||
|
|
||
| traverse(blocks).forEach(function (el) { | ||
| // Check if this element starts an exclusion zone | ||
| const startsExclusion = el && el.meta?.excludeFromTranslation; | ||
| if (startsExclusion) { | ||
| excludedDepth++; | ||
| } | ||
|
|
||
| // After processing children, decrement the counter if this element started an exclusion | ||
| this.after(function () { | ||
| if (startsExclusion) { | ||
| excludedDepth--; | ||
| } | ||
| }); | ||
|
|
||
| // Skip translation if we're inside an excluded block (excludedDepth > 0) | ||
| const isExcluded = excludedDepth > 0; | ||
|
|
||
| if (el && el.id && el.component?.name === 'Symbol' && !isExcluded) { | ||
| if (el && el.id && el.component?.name === 'Symbol') { | ||
| const symbolInputs = Object.entries(el.component?.options?.symbol?.data) || []; | ||
| if (symbolInputs.length) { | ||
| const transformedMeta = {}; | ||
|
|
@@ -406,7 +368,7 @@ export function applyTranslation( | |
| el && | ||
| el.id && | ||
| el.component?.name === 'Text' && | ||
| !isExcluded && | ||
| !el.meta?.excludeFromTranslation && | ||
| translation[`blocks.${el.id}#text`] | ||
| ) { | ||
| const localizedValues = | ||
|
|
@@ -443,7 +405,7 @@ export function applyTranslation( | |
| el && | ||
| el.id && | ||
| el.component?.name === 'Core:Button' && | ||
| !isExcluded && | ||
| !el.meta?.excludeFromTranslation && | ||
| translation[`blocks.${el.id}#text`] | ||
| ) { | ||
| const localizedValues = | ||
|
|
@@ -478,7 +440,7 @@ export function applyTranslation( | |
| } | ||
|
|
||
| // custom components | ||
| if (el && el.id && el.meta?.localizedTextInputs && !isExcluded) { | ||
| if (el && el.id && el.meta?.localizedTextInputs) { | ||
| // there's a localized input | ||
| const keys = el.meta?.localizedTextInputs as string[]; | ||
| let options = el.component.options; | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@builder.io/plugin-smartling", | ||
| "version": "0.0.23-13", | ||
| "version": "0.0.23-11", | ||
| "description": "", | ||
| "keywords": [], | ||
| "main": "dist/plugin.system.js", | ||
|
|
@@ -125,7 +125,7 @@ | |
| "typescript": "^3.0.3" | ||
| }, | ||
| "dependencies": { | ||
| "@builder.io/utils": "1.1.29", | ||
| "@builder.io/utils": "1.1.26", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dependency version mismatch between package.json and lockfileMedium Severity The Additional Locations (1) |
||
| "fast-json-stable-stringify": "^2.1.0", | ||
| "lodash": "^4.17.21", | ||
| "object-hash": "^3.0.0", | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test snapshot mismatch for button translation extraction
Medium Severity
The snapshot removes expected entries for
blocks.button-localized-text-id#textandblocks.button-plain-text-id#text, but the actual code intranslation-helpers.tsstill containsCore:Buttonhandling logic that extracts button text. The test data includes button components that will be extracted by the code, causing the snapshot test to fail.