Translating Schema in a JSP

If you need to use translated schema names in a custom JSP, this section shows you how.

  1. If the actual administrative object name is not available dynamically to the JSP, use the getPropertyValue method and enter the corresponding symbolic name and the session object as input parameters.

    Examples:


    • String typeName = Framework.getPropertyValue(session,"type_Part");

      Returns the actual administrative object name - "Part"

    • String attributeName = Framework.getPropertyValue(session,"attribute_LeadTime");

      Returns the actual administrative object name - "Lead Time"

    • String roleName = Framework.getPropertyValue(session,"role_DesignEngineer);

      Returns the actual administrative object name - "Design Engineer"

    • String stateName = Framework.getPropertyValue(session,"policy_ECPart");

      Returns the actual administrative object name - "EC Part"

  2. In the JSP, include emxI18NMethods.jsp which defines the utility methods that get the translated schema names from the StringResource files. These methods look up the resource bundle to get the translated value. If not found, it returns the same value back.

  3. As an input parameter for all of the utility methods, include the language string:

    String languageStr = request.getHeader("Accept-Language"); 
    

  4. Use this method signature in the JSP to get the translated schema names

    String displayAdminName = getAdminI18NString (<Admin Type>, <Admin 
    Name>, languageStr);
    

  5. In the JSP, get the translated schema names:

    For administratorive objects, use this method signature:

    String displayAdminName = getAdminI18NString (<Admin Type>, <Admin 
    Name>, languageStr);
    

    where:

    <Admin Type> is the type of administrative object, such as Type, Attribute, Role.

    <Admin Name> is the name of the administrative object for which translation is required. If the actual name is not available dynamically in the page, the name may be obtained from the symbolic name and using the lookup method described in 1.

    languageStr is the language setting obtained from the current request object.

    Examples:


    • String displayAdminName = getAdminI18NString ("Type", "Part", languageStr);

      Resource bundle property: emxFramework.Type.Part= Part

      Returns: "Part"

    • String displayAdminName = getAdminI18NString ("Type", "Mechanical Part", languageStr);

      Resource bundle property: emxFramework.Type.Mechanical_Part=Mechanical Part

      Returns: "Mechanical Part"

    • String displayAdminName = getAdminI18NString ("Policy", "EC Part", languageStr);

      Resource bundle property: emxFramework.Policy.EC_Part= EC Part

      Returns: "EC Part"

    • String displayAdminName = getAdminI18NString ("Relationship", "EBOM", languageStr);

      Resource bundle property: emxFramework.Relationship.EBOM= EBOM

      Returns: "EBOM"

    • String displayAdminName = getAdminI18NString ("Attribute", "Lead Time", languageStr);

      Resource bundle property: emxFramework.Attribute.Lead_Time= Lead Time

      Returns: "Lead Time"

    • String displayAdminName = getAdminI18NString ("Basic", "Revision", languageStr);

      Resource bundle property: emxFramework.Basic.Revision= Revision

      Returns: "Revision"

    For policy state names, use this method signature:

    String displayStateName  = getStateI18NString (<Policy Name>, <State 
    Name>, languageStr);
    

    where:

    <Policy Name> is the actual name of the policy for which the states are associated. If the actual name is not available dynamically in the page, the name may be obtained from the symbolic name and using the lookup method described in step 1.

    <State Name> is the actual name of the state for which translation is required. If the actual name is not available dynamically in the page, the name may be obtained from the symbolic name and using the lookup method.

    languageStr is the language setting obtained from the current request object.

    Examples:


    • String displayStateName = getStateI18NString ("EC Part", "Preliminary", languageStr);

      Resource bundle property: emxFramework.State.EC_Part.Preliminary = Preliminary

      Returns: "Preliminary"

    • String displayStateName = getStateI18NString ("EC Part", "Release", languageStr);

      Resource bundle property: emxFramework.State.EC_Part. Release = Release

      Returns: "Release"

    For attribute ranges, use this method signature:

    String dispRangeName = getRangeI18NString (<Attribute Name>, <Range 
    Value>, languageStr)
    

    where:

    <Attribute Name >is the actual name of the attribute that has this range value associated with it. If the actual name is not available dynamically in the page, the name may be obtained from the symbolic name and using the lookup method described in step 1.

    <Range Value> is one of the range values associated with this attribute and that needs to be translated. These range values may be obtained from the database for the given attribute.

    languageStr is the language setting obtained from the current request object.

    Examples:


    • String dispRangeName = getRangeI18NString ("Lead Time", "8 Weeks", languageStr)

      Resource bundle property: emxFramework.Range.Lead_Time.8_Weeks = 8 Weeks

      Returns: "8 Weeks"

    • String dispRangeName = getRangeI18NString ("Lead Time", "6 Weeks", languageStr)

      Resource bundle property: emxFramework.Range.Lead_Time.6_Weeks = 6 Weeks

      Returns: "6 Weeks"

    • String dispRangeName = getRangeI18NString ("Lead Time", "4 Weeks", languageStr)

      Resource bundle property: emxFramework.Range.Lead_Time.4_Weeks = 4 Weeks

      Returns: "4 Weeks"