IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

I18N and Import View

  • 1.  I18N and Import View

    Posted Tue March 01, 2011 03:47 PM

    Hi,

    I’ve used the CAF Tools Externalize Strings tool available in the Designer to achieve first version of the I18N.

    It works almost ok. The major problem is when I have views that import other views. In this case the imported view is not correctly internationalized.

    For instance in the text is shown:
    ???g11n.MultiSearch.Entity.pesquisa_de_entidades???:

    So the MultiSearch is the imported view.

    No errors are shown in the console.

    So, any idea how to correct this problem?

    Thanks in Advance


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 2.  RE: I18N and Import View

    Posted Tue March 01, 2011 04:16 PM

    Hi,

    One quick answer is to restore g11n.MultiSearch.Entity.pesquisa_de_entidades with the value from the .properties file.
    
    It is normal not to have any error since "g11n.MultiSearch.Entity.pesquisa_de_entidades" is replaced with the value from the .properties file.
    

    br,
    Vlad


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 3.  RE: I18N and Import View

    Posted Wed March 02, 2011 02:23 AM

    That’s an interesting one!

    I haven’t tried this, but in the included view, do you also have externalized resources? If so, can you copy (duplicate) g11n.MultiSearch.Entity.pesquisa_de_entidades into the included view’s resource file?


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 4.  RE: I18N and Import View

    Posted Wed March 02, 2011 11:18 AM

    The duplicate was not a good idea to me since I had to make double the translations.

    So my correction of the problem was to change the keys into the Application file, I also changed the imported view to get the I18N from the Application and not from the imported view, this solved the problem


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 5.  RE: I18N and Import View

    Posted Wed March 02, 2011 11:21 AM

    New Problem

    I have in property file
    g11n.MedicineContextInfo.default.desactivar=Deactivate
    g11n.MedicineContextInfo.default.activar=Activate

    Now in my view I want something like this:
    #{MedicineContextInfo.portletResources[“g11n.MedicineContextInfo.default.#{MedicineContextInfoDefaultviewView.activateDeactivate}”]}

    Basically I want to concat the result from the method activateDeactivate into the string “g11n.MedicineContextInfo.default”. However the second EL is never resolved and is simple appended to the String, which is not in the property file. As result this can not be correctly I18N.

    Any idea how to solve this?

    Thanks


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 6.  RE: I18N and Import View

    Posted Wed March 02, 2011 01:30 PM

    Hi Herve,

    I think in this case it is better to use the ternary operator in order to render a condition based on the value of a business field:

    #{MedicineContextInfoDefaultviewView.activateDeactivate eq 'activar' ? MedicineContextInfo.portletResources["g11n.MedicineContextInfo.default.activar"] : MedicineContextInfo.portletResources["g11n.MedicineContextInfo.default.desactivar"]} 

    However, I recommend that you have a boolean getter for the render condition:

    public class  MedicineContextInfo{
    boolean getIsActive(){
    ....
    }
    ...
    }

    br,
    Vlad


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 7.  RE: I18N and Import View

    Posted Wed March 02, 2011 02:42 PM

    Hi

    Thanks for you relpy.

    I already thought about that solution but that does not cover all my problems. Additionally I have another problem. I have a table where one of the column is the name of the week (en: Monday, Tuesday…; pt: Segunda, Terça). So the best way in this case is to contact the String to be I18N
    Property File
    g11n.MedicineContextInfo.date.default.seg
    g11n.MedicineContextInfo.date.default.ter
    g11n.MedicineContextInfo.date.default.qua
    g11n.MedicineContextInfo.date.default.qui.
    etc

    EL expression
    I would like to have something like that
    #{MedicineContextInfo.portletResources[“g11n.MedicineContextInfo.date.#{row.dayOfWeek}”]}.

    For instance, JBoss contains a Concat function that works in EL, does CAF contains something similar?

    I’m wondering how this problem is solved in CAF since this should be a normal problem.

    Thanks in Advance


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 8.  RE: I18N and Import View

    Posted Wed March 02, 2011 04:19 PM

    Hi,

    I think than in your case the day of the week will be determined in the bean.

    So, you should use I18N there.

    public class  MedicineContextInfo{
    public String getCurrentDayOfWeek(){
    //determine current day
    // get the proper I18n message
    String  dayOfWeek =  ContextUtils.localizeMessage(ContextUtils.getFacesContext(), bundleName, key, null, false);
    ....
    return ...;
    }
    ...
    }

    [url]http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite7/My_webMethods/7-2_CAF_and_MWS_Java_API_Reference/com/webmethods/caf/faces/context/ContextUtils.html#localizeMessage(FacesContext,%20java.lang.String,%20java.lang.String,%20java.lang.Object[],%20boolean)[/url]

    br,
    Vlad


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 9.  RE: I18N and Import View

    Posted Wed March 02, 2011 06:21 PM

    Yap, this solved the problem

    Thanks for your help :wink:


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine