fix: i18n decorator property definition #10521
Merged
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.
Problem:
The i18n bundle is stored as a static property in the child class where the
i18n
decorator is last used. This creates an issue when trying to access the static property from a parent class if it is overridden in the child class. The result might beundefined
because the bundle is only stored in the class where the decorator was last used.This issue can be observed on the https://sap.github.io/ui5-webcomponents/nightly/components/Tree/
Note: The issue is reproducible only if the
ui5-tree
andui5-tree-item
components are loaded. For local testing, the defined components in the bundle should be limited to just these two.Example:
Solution:
The loaded bundle is now stored in a bundle storage variable. A getter is defined for each property that stores a bundle in every class where
i18n
decorator is used. This ensures access to the bundle storage for every class where the i18n decorator is used.