Details

    • Type: Dev Task Dev Task
    • Status: Ready to Ship / Verified
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Team:
      Core

      Description

      I was able to get on-the-fly reloading of messages in resource bundles working by applying the attached hack. It's not fit for prod (since it uses an absolute path) but we might be able to get reloading working during development.

      We're already using ReloadableResourceBundleMessageSource (we need to because we have UTF-8 Java properties resource bundles), so by changing the configuration for this class, i18n work is easier and faster.

      Maybe we could parameterize the message bundle basenames, and only have cacheSeconds=0 during development (-1 otherwise).

        Activity

        Hide
        Stanley Kwok added a comment -

        Setting cacheSeconds to 0 without fudging basenames appears to be working. I was able to change a message and see the new change after a page reload.

        <!-- uncomment to enable automatic reloading of messages
        <property name="cacheSeconds" value="0" />
        -->

        Is this viable? Asking developer to uncomment this line if they want instant message loading to work? It would be nice if there is a way to hook this into workspace jetty server.

        Show
        Stanley Kwok added a comment - Setting cacheSeconds to 0 without fudging basenames appears to be working. I was able to change a message and see the new change after a page reload. <!-- uncomment to enable automatic reloading of messages <property name="cacheSeconds" value="0" /> --> Is this viable? Asking developer to uncomment this line if they want instant message loading to work? It would be nice if there is a way to hook this into workspace jetty server.
        Hide
        Stanley Kwok added a comment -

        There is a better solution. Changed messageSourceBean.xml to use a placeholder for cacheSeconds property. The default value (-1, defined in i18n.properties) disables automatic reloading and caches messages forever - which is what we want in production.

        To enable automatic reloading, add "i18.messages.cacheSeconds=0" in local.properties.

        Show
        Stanley Kwok added a comment - There is a better solution. Changed messageSourceBean.xml to use a placeholder for cacheSeconds property. The default value (-1, defined in i18n.properties) disables automatic reloading and caches messages forever - which is what we want in production. To enable automatic reloading, add "i18.messages.cacheSeconds=0" in local.properties.
        Hide
        Mifos Hudson Jira Plugin User added a comment -

        Integrated in head-master #2894
        MIFOS-4557: enable instant reloading of messages in resource bundles. Simply define a new property "i18.messages.cacheSeconds" in local.properties with a value of 0. The default value (-1) will cache messages forever.
        MIFOS-4557: fixed broken test. messageSourceBean.xml has a placeholder for cacheSeconds which is defined in propertyConfigurer.xml

        Stanley Kwok : 97440632438dab87151b3312f608f42e075e852c
        Files :

        • appdomain/src/main/resources/org/mifos/config/resources/messageSourceBean.xml
        • appdomain/src/main/resources/org/mifos/config/resources/i18n.properties
        • appdomain/src/main/resources/org/mifos/config/resources/propertyConfigurer.xml

        Stanley Kwok : 232719a3a10e9a5935b2c7a20a64b08361c512f7
        Files :

        • application/src/test/java/org/mifos/application/master/business/CustomFieldDefinitionEntityTest.java
        Show
        Mifos Hudson Jira Plugin User added a comment - Integrated in head-master #2894 MIFOS-4557 : enable instant reloading of messages in resource bundles. Simply define a new property "i18.messages.cacheSeconds" in local.properties with a value of 0. The default value (-1) will cache messages forever. MIFOS-4557 : fixed broken test. messageSourceBean.xml has a placeholder for cacheSeconds which is defined in propertyConfigurer.xml Stanley Kwok : 97440632438dab87151b3312f608f42e075e852c Files : appdomain/src/main/resources/org/mifos/config/resources/messageSourceBean.xml appdomain/src/main/resources/org/mifos/config/resources/i18n.properties appdomain/src/main/resources/org/mifos/config/resources/propertyConfigurer.xml Stanley Kwok : 232719a3a10e9a5935b2c7a20a64b08361c512f7 Files : application/src/test/java/org/mifos/application/master/business/CustomFieldDefinitionEntityTest.java
        Hide
        Mifos Hudson Jira Plugin User added a comment -

        Integrated in head-master-commit #4
        MIFOS-4557: enable instant reloading of messages in resource bundles. Simply define a new property "i18.messages.cacheSeconds" in local.properties with a value of 0. The default value (-1) will cache messages forever.
        MIFOS-4557: fixed broken test. messageSourceBean.xml has a placeholder for cacheSeconds which is defined in propertyConfigurer.xml

        Stanley Kwok : 97440632438dab87151b3312f608f42e075e852c
        Files :

        • appdomain/src/main/resources/org/mifos/config/resources/messageSourceBean.xml
        • appdomain/src/main/resources/org/mifos/config/resources/propertyConfigurer.xml
        • appdomain/src/main/resources/org/mifos/config/resources/i18n.properties

        Stanley Kwok : 232719a3a10e9a5935b2c7a20a64b08361c512f7
        Files :

        • application/src/test/java/org/mifos/application/master/business/CustomFieldDefinitionEntityTest.java
        Show
        Mifos Hudson Jira Plugin User added a comment - Integrated in head-master-commit #4 MIFOS-4557 : enable instant reloading of messages in resource bundles. Simply define a new property "i18.messages.cacheSeconds" in local.properties with a value of 0. The default value (-1) will cache messages forever. MIFOS-4557 : fixed broken test. messageSourceBean.xml has a placeholder for cacheSeconds which is defined in propertyConfigurer.xml Stanley Kwok : 97440632438dab87151b3312f608f42e075e852c Files : appdomain/src/main/resources/org/mifos/config/resources/messageSourceBean.xml appdomain/src/main/resources/org/mifos/config/resources/propertyConfigurer.xml appdomain/src/main/resources/org/mifos/config/resources/i18n.properties Stanley Kwok : 232719a3a10e9a5935b2c7a20a64b08361c512f7 Files : application/src/test/java/org/mifos/application/master/business/CustomFieldDefinitionEntityTest.java
        Hide
        Mifos Hudson Jira Plugin User added a comment -

        Integrated in acceptanceTestsImprovements #5
        MIFOS-4557: enable instant reloading of messages in resource bundles. Simply define a new property "i18.messages.cacheSeconds" in local.properties with a value of 0. The default value (-1) will cache messages forever.
        MIFOS-4557: fixed broken test. messageSourceBean.xml has a placeholder for cacheSeconds which is defined in propertyConfigurer.xml

        Stanley Kwok : 97440632438dab87151b3312f608f42e075e852c
        Files :

        • appdomain/src/main/resources/org/mifos/config/resources/messageSourceBean.xml
        • appdomain/src/main/resources/org/mifos/config/resources/i18n.properties
        • appdomain/src/main/resources/org/mifos/config/resources/propertyConfigurer.xml

        Stanley Kwok : 232719a3a10e9a5935b2c7a20a64b08361c512f7
        Files :

        • application/src/test/java/org/mifos/application/master/business/CustomFieldDefinitionEntityTest.java
        Show
        Mifos Hudson Jira Plugin User added a comment - Integrated in acceptanceTestsImprovements #5 MIFOS-4557 : enable instant reloading of messages in resource bundles. Simply define a new property "i18.messages.cacheSeconds" in local.properties with a value of 0. The default value (-1) will cache messages forever. MIFOS-4557 : fixed broken test. messageSourceBean.xml has a placeholder for cacheSeconds which is defined in propertyConfigurer.xml Stanley Kwok : 97440632438dab87151b3312f608f42e075e852c Files : appdomain/src/main/resources/org/mifos/config/resources/messageSourceBean.xml appdomain/src/main/resources/org/mifos/config/resources/i18n.properties appdomain/src/main/resources/org/mifos/config/resources/propertyConfigurer.xml Stanley Kwok : 232719a3a10e9a5935b2c7a20a64b08361c512f7 Files : application/src/test/java/org/mifos/application/master/business/CustomFieldDefinitionEntityTest.java
        Hide
        Adam Monsen added a comment -

        Great work Stanley, thank you!

        I'd recommend i18.messages.cacheSeconds=1 (in local.properties).

        Setting the cache seconds to 0 was causing certain pages to load extremely slowly (like, up to 30 seconds), such as home and admin. 1 second still provides very fast feedback, but avoids what appears to be some kind of bug in our code or ReloadableResourceBundleMessageSource or something.

        Show
        Adam Monsen added a comment - Great work Stanley, thank you! I'd recommend i18.messages.cacheSeconds=1 (in local.properties). Setting the cache seconds to 0 was causing certain pages to load extremely slowly (like, up to 30 seconds), such as home and admin. 1 second still provides very fast feedback, but avoids what appears to be some kind of bug in our code or ReloadableResourceBundleMessageSource or something.

          People

          • Assignee:
            Stanley Kwok
            Reporter:
            Adam Monsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 4 hours
              4h
              Remaining:
              Remaining Estimate - 4 hours
              4h
              Logged:
              Time Spent - Not Specified
              Not Specified