How to get resource bundle (for localization) in custom workflow process step

Avatar

Avatar

Sumit1191

Avatar

Sumit1191

Sumit1191

18-12-2020

How to get i18Dictionary object in custom workflow process step?

Following points tried :
1. As we dont have slingHttpRequest object exists so can not get resource bundle using request.
2. ResourceBundle rb = ResourceBundle.getBundle("projectName");
3. ResourceBundle rb = ResourceBundle.getBundle("project full qualified name");

View Entire Topic

Avatar

Avatar

KiranVedantam1992

Avatar

KiranVedantam1992

KiranVedantam1992

18-12-2020

Hi @Sumit1191 

 

You can use ResourceBundleProvider to fetch the ResourceBundle when you do not have the request object.

 

Try this:

@Reference (target= "(component.name=org.apache.sling.i18n.impl.JcrBundleProvider)")
ResourceBundleProvider rbp;

 

ResourceBundle bundle = rbp.getResourceBundle(locale);

 

Reference: https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html

 

Thanks,

Kiran Vedantam.