portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Liao (JIRA)" <jetspeed-...@portals.apache.org>
Subject [jira] Created: (JS2-280) The default value of xml:lang attribute in portlet.xml should be English and more(see the description)
Date Fri, 10 Jun 2005 09:16:52 GMT
The default value of xml:lang attribute in portlet.xml should be English and more(see the 
description)
-------------------------------------------------------------------------------------------------------

         Key: JS2-280
         URL: http://issues.apache.org/jira/browse/JS2-280
     Project: Jetspeed 2
        Type: Bug
  Components: Other  
    Versions: 2.0-M4    
 Environment: WinXP SP2, JDK 1.4.2_07
    Reporter: James Liao
    Priority: Critical


I have found four related problems.
1. In method "createPortletApplication" of class: org.apache.jetspeed.util.descriptor.PortletApplicationDescriptor,
the attribute of elements "display-name" and "description" should be xml:lang, not just lang,
for example:

digester.addSetProperties("portlet-app/portlet/display-name", "lang", "language");

2. According to PLT.21.8.1, The default value for the xml:lang attribute is English (“en”).
Portlet-container implementations using localized values of these elements should treat the
English (“en”) values as the default fallback value for all other locales. So it is wrong
to use "Locale.getDefault()" in class org.apache.jetspeed.util.JetspeedLocale. In my environment(SIMPLIFIED_CHINESE),
it always cause many problems. So I think we should change as following:
    /**
     * According to PLT.21.8.1, the default locale should be English.
     */
    public static Locale getDefaultLocale()
    {        
        return Locale.ENGLISH;
    } 

3. Enhance  PortletSelector to make it more robust.
In method getRows(RenderRequest request, String sql, int windowSize, String filter) of PortletSelector
portlet. If the HttpServletRequest's locale (Client browser's locale) is not supported by
portlet's display-name or description, it will cause a NullPointException when try to sort
the portlets. so I suggest that if client browser's locale can be support, we try to return
the default locale display-name or description. So I change it as following:

......
// Try to get the display-name of request locale. If can't, return the default English locale
display-name.
                String displayNameText = portlet.getDisplayNameText(locale);
                if(displayNameText == null || displayNameText.length() == 0)
                    displayNameText = portlet.getDisplayNameText(Locale.ENGLISH);
                
                // Try to get the descriptionText of request locale. If can't, return the
default English locale display-name.
                String descriptionText = portlet.getDescriptionText(locale);
                if(descriptionText == null || descriptionText.length() == 0)
                    descriptionText = portlet.getDescriptionText(Locale.ENGLISH);        
       
                
                list.add(new PortletInfo(appName + "::" + portlet.getName(), displayNameText,
descriptionText));
            }            
            BrowserIterator iterator = new PortletIterator(
                    list, resultSetTitleList, resultSetTypeList,
                    windowSize);
            setBrowserIterator(request, iterator);
            iterator.sort("Portlet");
        }
......

4. I found many bundled portlets' portlet.xml aren't so standard in J2. They use lang instead
of xml:lang ererywhere.

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


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


Mime
View raw message