Community

I18n : create mail with ressource bundles ?

reply from Mark Roy in jBPM - View the full discussion

I've given this some thought myself, but haven't implemented anything yet. There's nothing available "out of the box", but I believe it can be done on your own. I guess the solution depends on what your requirement is.

 

If you only need to internationalize per jBPM installation, use the mail template feature. Move all mail message text out of the jPDL and into a separate mail template file (which essentially would be a resource file), then import the resource ( <import resource="mailtext.jbpm.cfg.xml" /> ) in jbpm.cfg.xml. Deploy the appropriate mail template file during app installation.

 

If you need to internationalize per process instance, you could create a process variable(s) to hold the appropriate text for that instance. Then, use process variable references in your mail templates rather than hard-coded text. The variables have to be serializable, so something based on ResourceBundle won't work unless you do something extra.

 

The jBPM JuelScriptEngine seems like it wll resolve resource variables: chain.add( new ResourceBundleELResolver());, but I don't know what those references would look like or how to load the bundle. Perhaps someone else can shed some light?

 

Finally, if you need to internationalize mail text based on the locale of the recipient(s), it looks like you'd have to create your own MailProducer, which is a supported extension point. You'd probably have to create your own IdentitySession implementation, since locale is not included in the default implementation.

Reply to this message by going to Community

Start a new discussion in jBPM at Community