-
1. Re: I18n : create mail with ressource bundles ?
rebody May 10, 2010 9:26 PM (in response to newbeewan)Hi Jaber,
jBPM 4 does not support i18n for email template yet. You could create a issue for that. But I afraid it won't be supported very soon.
-
2. Re: I18n : create mail with ressource bundles ?
markroy May 11, 2010 11:33 AM (in response to newbeewan)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 or Hibernate-based, 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 as well, since locale is not included in the default implementation.
-
3. Re: I18n : create mail with ressource bundles ?
newbeewan May 12, 2010 3:05 AM (in response to markroy)Thanks for your replies.
As I'm using spring with jbpm, I think I will looking arround with the resource bundle of spring, and I thinking about velocity to générate content as string for subject and content with an event listener (start event of mail task) and putting all i18n resources into some resource bundle.
An other option is to extend MailProducer and manage all resources within spring.
I don't know if it's an optimised way but it seem to be not too horrible to implements.
Regards