In sightly, for example, we use ${'lbl.global.loginText' @ i18n} to use I18N keys. Where is "i18n" defined in this case? In jsps we use as follows:
final ResourceBundle resourceBundle = slingRequest.getResourceBundle("basename", currentPage.getLanguage(true));
I18n i18n = new I18n(resourceBundle);
Where/how do we do this in sightly?
Help would be greatly appreciated.
Thanks,
Mohan
Views
Replies
Total Likes
Have you looked at using this via a HTL (Sightly) Java class that extends WCMUsePojo?
Views
Replies
Total Likes
Use WCMUsePojo to create these Objects. For example- the WCMUsePojo has this method:
SlingHttpServletRequest getRequest()
Using a SLingHttpServletRequest - you can invoke this method.
ResourceBundle getResourceBundle(Locale locale)
This is how you get a ResourceBundle .
If you are not sure how to create a HTL (Sightly) component that uses WCMUsePojo - see this artilce and video:
https://helpx.adobe.com/experience-manager/using/htl_61.html
Hope this helps....
Views
Replies
Total Likes
You can do this too:
${'Hello World' @ i18n, locale=request.locale}
More info here:
https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md
Views
Replies
Total Likes
Hi Feike, thanks for your response. I want to pass both basename and locale. The one you mentioned accepts only locale but not basename.
Thanks,
Mohan
Views
Replies
Total Likes
Hi Mac, thanks for your response. The method getResourceBundle(Locale locale) accepts only Locale. I want to pass both basename, locale where basename would be the application/brand name. Based on brand/base name I want to load different dictionaries for different applications. I am new to HTL. Anyhow I will try using HTL as you suggested and see if I can achieve that.
Thanks,
Mohan
Views
Replies
Total Likes
Views
Likes
Replies