Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: i18n decorator property definition (#10521)
**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 be `undefined` 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` and `ui5-tree-item` components are loaded. For local testing, the defined components in the bundle should be limited to just these two. **Example:** ```typescript abstract class ListItem extends ListItemBase { @i18n("@ui5/webcomponents") static i18nBundle: I18nBundle; get _accInfo(): AccInfo { return { ariaLabel: ListItem.i18nBundle.getText(ARIA_LABEL_LIST_ITEM_CHECKBOX) // This ListItem.i18nBundle is undefined because the bundle is only registered in TreeItemBase. }; } } class TreeItemBase extends ListItem { @i18n("@ui5/webcomponents") static i18nBundle: I18nBundle; } ``` **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.
- Loading branch information