3 Replies Latest reply on May 12, 2010 3:05 AM by Jaber C. Mourad

    I18n : create mail with ressource bundles ?

    Jaber C. Mourad Novice



      I'm looking for creating some translation bundles for email sent by jbpm 4.3.


      I haven't seem any infos in documentation to do it (perhaps I missed it !).


      Is it possible directly in jpdl, how ?



        • 1. Re: I18n : create mail with ressource bundles ?
          HuiSheng Xu Master

          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 ?
            Mark Roy Newbie

            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 ?
              Jaber C. Mourad Novice

              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.