You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/07/08 21:22:05 UTC

cvs commit: jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl LanguageImpl.java LanguageSetImpl.java

taylor      2004/07/08 12:22:05

  Modified:    components/registry/src/java/org/apache/jetspeed/om/impl
                        LanguageImpl.java LanguageSetImpl.java
  Log:
  a quick patch to get JSR-168 resource bundles working in Jetspeed
  this is by far not a final solution, quite a bit to be done there, but at least we can now load resources from a bundle
  one limitation, since we don't persist the bundle name in the registry yet, is that you have to name (prefix) your bundles with the name "portlet"
  i.e. portlet_en.properties
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.4       +3 -3      jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageImpl.java
  
  Index: LanguageImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LanguageImpl.java	8 Mar 2004 00:48:51 -0000	1.3
  +++ LanguageImpl.java	8 Jul 2004 19:22:05 -0000	1.4
  @@ -60,7 +60,7 @@
   
       protected long portletId;
   
  -    protected static final String RESOURCE_BUNDLE_NAME = "portalResources";
  +    protected static final String RESOURCE_BUNDLE_NAME = "portlet";
   
       public LanguageImpl()
       {
  @@ -115,7 +115,7 @@
        */
       public ResourceBundle getResourceBundle()
       {
  -        return ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME, getLocale());
  +        return ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME, getLocale(), Thread.currentThread().getContextClassLoader());
       }
   
       /**
  
  
  
  1.3       +6 -2      jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageSetImpl.java
  
  Index: LanguageSetImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageSetImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LanguageSetImpl.java	8 Mar 2004 00:48:51 -0000	1.2
  +++ LanguageSetImpl.java	8 Jul 2004 19:22:05 -0000	1.3
  @@ -93,6 +93,7 @@
           while (searchItr.hasNext())
           {
   			Language lang = (Language) searchItr.next();
  +            
               if (lang.getLocale().equals(locale))
               {
                   return lang;
  @@ -103,7 +104,10 @@
               }
   
           }
  -
  +        if (fallBack == null)
  +        {
  +            fallBack = new LanguageImpl(locale, "");
  +        }
           return fallBack;
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org