ICEfaces
  1. ICEfaces
  2. ICE-5290

outputMessageRenderer should use ViewRoot locale

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2-EE-GA
    • Fix Version/s: 1.8.2-EE-GA_P01, 1.8.3
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      -

      Description

      Issue description from forum post:
      ----------------------------------------------

      There's a bug in RenderKit's OutputMessageRenderer (the renderer for ice:outputFormat): the used message formatter will not use the ViewRoot's locale (session locale), instead Locale.getDefault() will be used.

      -> So I've a problem if I want to show a RessourceBundle message like "{0} darf nicht früher sein als {1,date}" in the user's language and default (date) formats (e.g. for german: dd.MM.yyyy).

      I've fixed this by overwriting the OutputMessageRenderer:
      Code:

       ...
       // uiComponentValue = MessageFormat.format(uiComponentValue, parameters);
       MessageFormat mf = new MessageFormat(uiComponentValue, facesContext.getViewRoot().getLocale());
       uiComponentValue = mf.format(parameters);
       ...
       

        Activity

        Hide
        Mark Collette added a comment -

        Tested the suggestion, with formatting of floats, and confirmed that before the decimal would not change between . and , for USA and German in the component-showcase, but after the change it did, demonstrating that the new code now makes use of the UIViewRoot's Locale.

        TRUNK
        Subversion 20974
        icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java

        icefaces-ee-1.8.2
        Subversion 20975
        icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java

        Show
        Mark Collette added a comment - Tested the suggestion, with formatting of floats, and confirmed that before the decimal would not change between . and , for USA and German in the component-showcase, but after the change it did, demonstrating that the new code now makes use of the UIViewRoot's Locale. TRUNK Subversion 20974 icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java icefaces-ee-1.8.2 Subversion 20975 icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java
        Hide
        Tyler Johnson added a comment -

        The ViewRoot's Locale sounds like the only valid Locale to ever use.

        Mojarra 1.2_12's OutputMessageRenderer explicitly uses the ViewRoot's Locale. It looks like ours doesn't though:

        \icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java

        uiComponentValue =
        MessageFormat.format(uiComponentValue, parameters);

        • Mark
        Show
        Tyler Johnson added a comment - The ViewRoot's Locale sounds like the only valid Locale to ever use. Mojarra 1.2_12's OutputMessageRenderer explicitly uses the ViewRoot's Locale. It looks like ours doesn't though: \icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java uiComponentValue = MessageFormat.format(uiComponentValue, parameters); Mark

          People

          • Assignee:
            Unassigned
            Reporter:
            Tyler Johnson
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: