[jboss-jira] [JBoss JIRA] Updated: (JBSEAM-421) Update to Seam i18n to support resource bundle types

Todd Smart (JIRA) jira-events at jboss.com
Tue Oct 17 11:12:41 EDT 2006


     [ http://jira.jboss.com/jira/browse/JBSEAM-421?page=all ]

Todd Smart updated JBSEAM-421:
------------------------------

        Summary: Update to Seam i18n to support resource bundle types  (was: Update to Seam i18n to support DatabaseResourceBundle)
    Description: 
The current Seam i18n ResourceBundle class only supports loading java.util.ResourceBundle resource bundles.

Feature Request:
------------------------
1) Add an attribute to ResourceBundle called: resourceType (to facilitate use of other resource bundle types).  This attribute would be configured in seam.properties.
2) Update the loadBundle() method to allow for loading through other resource bundle types.

See attached update to org.jboss.seam.ResourceBundle (sample supporting classes, property file, and sql script also provided for reference).


Regards,

Todd Smart
todd.smart at smartbinary.com


  was:
The current Seam i18n ResourceBundle class only supports loading java.util.ResourceBundle resource bundles.  For ref, the loadBundle() method is:

{code}
   private void loadBundle() 
   {
      try
      {
         bundle = java.util.ResourceBundle.getBundle( 
               bundleName, 
               Locale.instance(), 
               Thread.currentThread().getContextClassLoader() 
            );
         log.debug("loaded resource bundle: " + bundleName);
      }
      catch (MissingResourceException mre)
      {
         log.debug("resource bundle missing: " + bundleName);
      }
   }
{code}

I've updated the org.seam.core.ResourceBundle class to plug into the org.sadun.util.DatabaseResourceBundle ... providing for a very flexible, db-driven i18n system.

The only change required (for the prototype code!) to get this to work was an update to the Seam ResourceBundle was:

{code}
    private void loadBundle() {
        try {
            DatabaseResourceBundle databaseResourceBundle = new DatabaseResourceBundle(jdbcUrl, bundleName, Locale.instance());
            bundle = databaseResourceBundle;
            log.debug("loaded resource bundle: " + bundleName);
        } catch (MissingResourceException mre) {
            log.debug("resource bundle missing: " + bundleName);
        }
    }
{code}

Beyond the prototype, of course, this will be cleaned up.  I'm thinking others may benefit from updating this Seam class to allow for supporting other types of resource bundle repositories.

Feature Request:
------------------------
1) Add an attribute to ResourceBundle called: resourceType (thus allowing a class to be called to load a bundle).  This attribute would be configured in seam.properties.
2) Update the loadBundle() method such that if resourceType is not null, to get an instance of ResourceType.instance() followed by a call to resourceType.loadBundle() method

I don't mind contributing the code ... just testing the waters first.


Regards,

Todd Smart
todd.smart at smartbinary.com



updated description to be more generic (decoupled of specific resource bundle types)

> Update to Seam i18n to support resource bundle types
> ----------------------------------------------------
>
>                 Key: JBSEAM-421
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-421
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>    Affects Versions: 1.1
>            Reporter: Todd Smart
>             Fix For: 1.1
>
>         Attachments: extras.zip, ResourceBundle.java, ResourceBundle.java
>
>
> The current Seam i18n ResourceBundle class only supports loading java.util.ResourceBundle resource bundles.
> Feature Request:
> ------------------------
> 1) Add an attribute to ResourceBundle called: resourceType (to facilitate use of other resource bundle types).  This attribute would be configured in seam.properties.
> 2) Update the loadBundle() method to allow for loading through other resource bundle types.
> See attached update to org.jboss.seam.ResourceBundle (sample supporting classes, property file, and sql script also provided for reference).
> Regards,
> Todd Smart
> todd.smart at smartbinary.com

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list