Repository navigation
Conversation
…n with the original copyNodes() gave new i18n ids only to the fields inside the copied step's components. The step's own title.i18n id was left as it was, so the copy and the original pointed at the same entry in every translation file. Editing either step's title in a non-default language changed both. The default language was unaffected because the title text is stored on the node itself. copyNodes() now collects i18n keys from the whole node, which covers the title and every component field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a unit with more than one language, copying a step produces a copy whose title is tied to the original's in every non-default language.
copyNodes()inCopyTranslationsServicegives new i18n ids only to fields inside the copied step's components. The step's owntitle.i18nid is carried over unchanged, so the copy and the original point at the same entry in eachtranslations.<locale>.json.The effect for authors is that editing either step's title in a non-default language changes the other one too. The title in the default language behaves normally, because that text is stored on the node itself rather than looked up by id, so the problem only shows when switching the authoring language. It is easy to miss: an author who renames the copy's translated title silently overwrites the original's, and the original title can only be recovered by retyping it.
Units that already contain such copies keep the shared id after this change; it prevents new ones from being created. An affected step can be separated by removing its
title.i18nin the step's advanced JSON view and entering its translated title again, which creates a new id.Changes
copyNodes()collects i18n keys from the whole node withgetI18NKeys(node)instead of from each component.getI18NKeys()already walks nested objects and arrays, so this covers the step title and every component field, and any other node-level translatable field.Test
tryCopyNodes()case incopyTranslationsService.spec.ts: copying a step whose title and component prompt both have i18n ids gives each a new id, saves the new ids with the original translations, keeps the original entries, and saves the project. Against the currentdevelop, it fails withExpected 'titleId' not to equal 'titleId'.