ICEfaces
  1. ICEfaces
  2. ICE-2763

Add new ice:loadBundle component (locale of messages bundle cannot be changed dynamically)

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8DR#2, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      All
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial

      Description

      Since <f:loadBundle> will cache the resource properties, changing the locale of the UIViewRoot dynamically does not cause the messages to update because the resource bundle is not reloaded. In order to reload the resource bundle, need to refresh the page or use redirect, but this causes a new UIViewRoot to be created and it will use the config and browser settings to determine the locale and load the bundle before the backing bean can set the locale of the ViewRoot.

      Need a custom loadBundle that will prevent the bundle from caching and allow messages bundle to dynamically change when the locale is changed

        Issue Links

          Activity

          Jacky Lee created issue -
          Jacky Lee made changes -
          Field Original Value New Value
          Assignee Ken Fyten [ ken.fyten ]
          Ken Fyten made changes -
          Security Private [ 10001 ]
          Assignee Ken Fyten [ ken.fyten ] Mark Collette [ mark.collette ]
          Hide
          Mark Collette added a comment -

          Yes, I think it shows the need for an ice:loadBundle component, which will detect Locale changes, and uncache old ResourceBundles appropriately.

          Show
          Mark Collette added a comment - Yes, I think it shows the need for an ice:loadBundle component, which will detect Locale changes, and uncache old ResourceBundles appropriately.
          Hide
          Ted Goddard added a comment -

          An ice:loadBundle component would also simplify the Bridge since bundles would not need to be propagated in the requestMap.

          Show
          Ted Goddard added a comment - An ice:loadBundle component would also simplify the Bridge since bundles would not need to be propagated in the requestMap.
          Hide
          Woolfgang Schuh added a comment -

          To use use ICE-Faces in an WEB-Application with international accounts/Users, it is a "MUST" to
          to solve this problem.

          Show
          Woolfgang Schuh added a comment - To use use ICE-Faces in an WEB-Application with international accounts/Users, it is a "MUST" to to solve this problem.
          Ken Fyten made changes -
          Assignee Priority P3
          Ken Fyten made changes -
          Link This issue depends on ICE-3500 [ ICE-3500 ]
          Ken Fyten made changes -
          Fix Version/s 1.8DR#2 [ 10142 ]
          Hide
          David Josep added a comment -

          It should compatible to use with actual MessageBundleLoader to avoid to change the current code.

          Show
          David Josep added a comment - It should compatible to use with actual MessageBundleLoader to avoid to change the current code.
          Ken Fyten made changes -
          Assignee Mark Collette [ mark.collette ] Adnan Durrani [ adnan.durrani ]
          Ken Fyten made changes -
          Summary locale of messages bundle cannot be changed dynamically Add new ice:loadBundle component (locale of messages bundle cannot be changed dynamically)
          Affects [Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial]
          Assignee Priority P3 P2
          Hide
          Krashan Brahmanjara added a comment -

          Using f:loadBundle or ice:loadBundle is completely not necessary!
          For good performance use features of jsf.1.2

          <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
          (...)
          <application>
          (...)
          <resource-bundle>
          <base-name>...messages</base-name>
          <var>msg1</var>
          </resource-bundle>
          <resource-bundle>
          <base-name>...messages2</base-name>
          <var>msg2</var>
          </resource-bundle>
          (...)
          <application>
          (...)

          Show
          Krashan Brahmanjara added a comment - Using f:loadBundle or ice:loadBundle is completely not necessary! For good performance use features of jsf.1.2 <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd "> (...) <application> (...) <resource-bundle> <base-name>...messages</base-name> <var>msg1</var> </resource-bundle> <resource-bundle> <base-name>...messages2</base-name> <var>msg2</var> </resource-bundle> (...) <application> (...)
          Hide
          Klaus Stake added a comment -

          @Krashan: it is necessary! For example we have an application where we dynamically change theme and language. We need to dynamically change the message bundles. Which seems not to be possible the way you described.

          Show
          Klaus Stake added a comment - @Krashan: it is necessary! For example we have an application where we dynamically change theme and language. We need to dynamically change the message bundles. Which seems not to be possible the way you described.
          Hide
          Paul van Rossem added a comment -

          I also use the resource bundle as explained by Krashan. That really, really works. I remember the user's locale in a bean and specify it to the view root in <f:view locale="#

          {bean.locale}

          " ... >. Just let the user alter the locale property in the bean by clicking a flag or so and on the next page reload you see the new language. No problem. No need to fuzz around with the message bundles. All taken care of by JSF. Or is this not what you want?

          Show
          Paul van Rossem added a comment - I also use the resource bundle as explained by Krashan. That really, really works. I remember the user's locale in a bean and specify it to the view root in <f:view locale="# {bean.locale} " ... >. Just let the user alter the locale property in the bean by clicking a flag or so and on the next page reload you see the new language. No problem. No need to fuzz around with the message bundles. All taken care of by JSF. Or is this not what you want?
          Adnan Durrani made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17868 Wed Nov 05 21:21:35 MST 2008 adnan.durrani ICE-2763 (Add new ice:loadBundle component (locale of messages bundle cannot be changed dynamically))
          Files Changed
          Commit graph ADD /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/loadbundle
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/utils/MessageUtils.java
          Commit graph ADD /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-loadbundle-props.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/extended-faces-config.xml
          Commit graph ADD /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/loadbundle/LoadBundle.java
          Commit graph ADD /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/custom/loadbundle-component.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/component/conf/META-INF/faces-config.xml
          Commit graph ADD /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/custom/loadbundle-renderer.xml
          Hide
          Adnan Durrani added a comment -

          ice:loadBundle added to the trunk:

          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\conf\META-INF\faces-config.xml
          Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\loadbundle
          Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\loadbundle\LoadBundle.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java
          Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-component.xml
          Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-renderer.xml
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\extended-faces-config.xml
          Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-loadbundle-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-renderer.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\loadbundle\LoadBundle.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-loadbundle-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\conf\META-INF\faces-config.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\extended-faces-config.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-component.xml
          Completed: At revision: 17868

          Show
          Adnan Durrani added a comment - ice:loadBundle added to the trunk: Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\conf\META-INF\faces-config.xml Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\loadbundle Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\loadbundle\LoadBundle.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-component.xml Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-renderer.xml Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\extended-faces-config.xml Adding: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-loadbundle-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-renderer.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\loadbundle\LoadBundle.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-loadbundle-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\conf\META-INF\faces-config.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\extended-faces-config.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\custom\loadbundle-component.xml Completed: At revision: 17868
          Hide
          Klaus Stake added a comment -

          @Paul and Krashan: You're right. For my purposes I can really use standard JSF means. I've just given it a try. Sorry for my doubts.

          Show
          Klaus Stake added a comment - @Paul and Krashan: You're right. For my purposes I can really use standard JSF means. I've just given it a try. Sorry for my doubts.
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17870 Thu Nov 06 10:30:21 MST 2008 adnan.durrani ICE-2763 (Add new ice:loadBundle component (locale of messages bundle cannot be changed dynamically))
          Locale changes respected
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/loadbundle/LoadBundle.java
          Hide
          Adnan Durrani added a comment -

          locale changes respected. revision 17870

          Show
          Adnan Durrani added a comment - locale changes respected. revision 17870
          Adnan Durrani made changes -
          Link This issue depends on ICE-3755 [ ICE-3755 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17874 Thu Nov 06 20:27:02 MST 2008 adnan.durrani ICE-2763 (Add new ice:loadBundle component (locale of messages bundle cannot be changed dynamically))
          TLD docs added
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-loadbundle-props.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/custom/loadbundle-renderer.xml
          Hide
          Adnan Durrani added a comment -

          TLDDocs added: revision 17874

          Show
          Adnan Durrani added a comment - TLDDocs added: revision 17874
          Hide
          Krashan Brahmanjara added a comment -

          Locale with <resource-bundle> works well.

          I think that this new feature will start a new set of problems for not advanced users.

          Show
          Krashan Brahmanjara added a comment - Locale with <resource-bundle> works well. I think that this new feature will start a new set of problems for not advanced users.
          Hide
          Ken Fyten added a comment -

          The new ice:loadBundle component added to the trunk. Its provides two dynamic features:

          1- the message bundle base can be changed dynamically. (So you can change entire messages bundle)
          2- if the "locale" has changed on ViewRoot dynamically, it reloads the bundle for the corresponding locale.

          Feature "1" is working fine, but feature "2" is not working due to the fact that we use the same ViewRoot on each request for the same page and in the D2DViewHandler there is a call "setLocale" on viewRoot which cache the locale into the viewRoot, so the getViewRoot always returns the cached locale and doesn't respect the value binding. This is captured in ICE-3755.

          Show
          Ken Fyten added a comment - The new ice:loadBundle component added to the trunk. Its provides two dynamic features: 1- the message bundle base can be changed dynamically. (So you can change entire messages bundle) 2- if the "locale" has changed on ViewRoot dynamically, it reloads the bundle for the corresponding locale. Feature "1" is working fine, but feature "2" is not working due to the fact that we use the same ViewRoot on each request for the same page and in the D2DViewHandler there is a call "setLocale" on viewRoot which cache the locale into the viewRoot, so the getViewRoot always returns the cached locale and doesn't respect the value binding. This is captured in ICE-3755.
          Hide
          Adnan Durrani added a comment -

          demo added

          Show
          Adnan Durrani added a comment - demo added
          Adnan Durrani made changes -
          Attachment ICE-2763.war [ 11346 ]
          Adnan Durrani made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Link This issue blocks ICE-3790 [ ICE-3790 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17918 Thu Nov 20 11:04:44 MST 2008 adnan.durrani Fix related to ICE-2763 (Add new ice:loadBundle component (locale of messages bundle cannot be changed dynamically))
          JSF 1.1 support added
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/loadbundle/LoadBundle.java
          Hide
          Adnan Durrani added a comment -

          Not working with JSF 1.1

          Show
          Adnan Durrani added a comment - Not working with JSF 1.1
          Hide
          Adnan Durrani added a comment -

          support added for JSF 1.1
          trunk revision 17918

          Show
          Adnan Durrani added a comment - support added for JSF 1.1 trunk revision 17918
          Ken Fyten made changes -
          Fix Version/s 1.8 [ 10161 ]
          Assignee Priority P2
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Adnan Durrani [ adnan.durrani ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Jacky Lee
            • Votes:
              14 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: