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/08/16 20:26:22 UTC
cvs commit: jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container JetspeedPortletConfig.java
taylor 2004/08/16 11:26:22
Modified: commons/src/java/org/apache/jetspeed/container
JetspeedPortletConfig.java
Log:
adding support for full language support for JSR 168, contribution from Shinsuke
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 +13 -26 jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedPortletConfig.java
Index: JetspeedPortletConfig.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedPortletConfig.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedPortletConfig.java 20 Mar 2004 19:27:41 -0000 1.3
+++ JetspeedPortletConfig.java 16 Aug 2004 18:26:21 -0000 1.4
@@ -19,7 +19,6 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.ListResourceBundle;
import javax.servlet.ServletConfig;
import javax.portlet.PortletConfig;
@@ -28,6 +27,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.om.common.Language;
+import org.apache.pluto.om.common.LanguageSet;
import org.apache.pluto.om.common.Parameter;
import org.apache.pluto.om.common.ParameterSet;
import org.apache.pluto.om.portlet.PortletDefinition;
@@ -46,14 +47,12 @@
private ServletConfig servletConfig;
private PortletContext portletContext;
private PortletDefinition portletDefinition;
- private ResourceBundle resources;
public JetspeedPortletConfig(ServletConfig servletConfig, PortletContext portletContext, PortletDefinition portletEntity)
{
this.servletConfig = servletConfig;
this.portletContext = portletContext;
this.portletDefinition = portletEntity;
- this.resources = new Resources(this);
}
public String getPortletName()
@@ -68,7 +67,16 @@
public ResourceBundle getResourceBundle(Locale locale)
{
- return this.resources;
+ LanguageSet languageSet = portletDefinition.getLanguageSet();
+ Language lang = languageSet.get(locale);
+
+ if (lang == null)
+ {
+ Locale defaultLocale = languageSet.getDefaultLocale();
+ lang = languageSet.get(defaultLocale);
+ }
+
+ return lang.getResourceBundle();
}
public String getInitParameter(java.lang.String name)
@@ -119,27 +127,6 @@
public PortletDefinition getPortletDefinition()
{
return portletDefinition;
- }
-
- private static class Resources extends ListResourceBundle
- {
- private Object[][] resources = null;
-
- public Resources(PortletConfig config) // TODO: PortletInfo info
- {
- // once Portlet Info is sorted out and implemented, change this to use
- // portlet info
- resources = new Object[][] { { "javax.portlet.title", config.getPortletName()}, {
- "javax.portlet.short-title", config.getPortletName()
- }, {
- "javax.portlet.keywords", "no keywords" }
- };
- }
-
- public Object[][] getContents()
- {
- return resources;
- }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org