You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After some struggle I have found a way to override the original messages (i18n) of Web Components (Main and Fiori). Could anybody tell me if there's a more canonical way? My solution is more a hack than a clean solution.
My directory structure is as follows:
assets
i18n
es
messagebundle.properties (Application's messages)
ui5-web-components
messagebundle.properties (Overrides for Main)
ui5-web-components-fiori
messagebundle.properties (Overrides for Fiori)
Code (NOTE: the code is using the explicit locale "es"):
//Application messagesregisterI18nLoader("MyApp","es",async(localeId)=>{constprops=await(awaitfetch(`./assets/i18n/es/messagebundle.properties`)).text();returnparseProperties(props);});//Overrides for @ui5/webcomponentsregisterI18nLoader("@ui5/webcomponents","es",async(localeId)=>{constprops=await(awaitfetch(`./assets/i18n/es/ui5-webcomponents/messagebundle.properties`)).text();constoverrides=parseProperties(props);constoriginal=(awaitimport("@ui5/webcomponents/dist/generated/assets/i18n/messagebundle_es.json")).default;for(constnameinoverrides){original[name]=overrides[name];}returnoriginal;});//Overrides for @ui5/webcomponents-fioriregisterI18nLoader("@ui5/webcomponents-fiori","es",async(localeId)=>{constprops=await(awaitfetch(`./assets/i18n/es/ui5-webcomponents-fiori/messagebundle.properties`)).text();constoverrides=parseProperties(props);constoriginal=(awaitimport("@ui5/webcomponents-fiori/dist/generated/assets/i18n/messagebundle_es.json")).default;for(constnameinoverrides){original[name]=overrides[name];}returnoriginal;});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
After some struggle I have found a way to override the original messages (i18n) of Web Components (Main and Fiori). Could anybody tell me if there's a more canonical way? My solution is more a hack than a clean solution.
My directory structure is as follows:
Code (NOTE: the code is using the explicit locale "es"):
Beta Was this translation helpful? Give feedback.
All reactions