Author: thomas.heute(a)jboss.com
Date: 2008-06-02 09:46:10 -0400 (Mon, 02 Jun 2008)
New Revision: 10902
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties
Log:
More i18n
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java 2008-06-02
13:22:58 UTC (rev 10901)
+++
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java 2008-06-02
13:46:10 UTC (rev 10902)
@@ -22,12 +22,23 @@
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.common.i18n.SimpleResourceBundleFactory;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.control.ControlConstants;
+import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletRequest;
+
import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
+import java.util.Map;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
@@ -37,44 +48,66 @@
{
/** . */
- private List portalSelectItems;
+ private Map<Locale, List<SelectItem>> portalSelectItems;
/** . */
- private List pageSelectItems;
+ private Map<Locale, List<SelectItem>> pageSelectItems;
/** . */
+ private static final String BUNDLE_BASE_NAME = "Resource";
+
+ /** . */
final PortalObjectManagerBean pomgr;
- private static final String DISPLAY_THE_DEFAULT_ERROR_MESSAGE = "Display the
default error message";
- private static final String REDIRECT_TO_THE_SPECIFIED_RESOURCE = "Redirect to the
specified resource";
- private static final String REMOVE_THE_RESOURCE_FROM_PAGE = "Remove the resource
from page";
+ private static LocalizedString DISPLAY_THE_DEFAULT_ERROR_MESSAGE = null;
+ private static LocalizedString REDIRECT_TO_THE_SPECIFIED_RESOURCE = null;
+ private static LocalizedString REMOVE_THE_RESOURCE_FROM_PAGE = null;
public ControlPropertiesBean(PortalObjectManagerBean pomgr)
{
this.pomgr = pomgr;
+
+ ResourceBundleManager rbm = new ResourceBundleManager(null, new
SimpleResourceBundleFactory(BUNDLE_BASE_NAME,
PropertiesInfoBuilder.class.getClassLoader()));
+ // Load all supported locales
+ PortletRequest portletRequest =
(PortletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
+ Enumeration<Locale> locales =
((PortletConfig)portletRequest.getAttribute("javax.portlet.config")).getSupportedLocales();
+ while (locales.hasMoreElements())
+ {
+ Locale locale = locales.nextElement();
+ rbm.getResourceBundle(locale);
+ }
+ DISPLAY_THE_DEFAULT_ERROR_MESSAGE =
rbm.getLocalizedValue("DISPLAY_THE_DEFAULT_ERROR_MESSAGE", "Display the
default error message");
+ REDIRECT_TO_THE_SPECIFIED_RESOURCE =
rbm.getLocalizedValue("REDIRECT_TO_THE_SPECIFIED_RESOURCE", "Redirect to
the specified resource");
+ REMOVE_THE_RESOURCE_FROM_PAGE =
rbm.getLocalizedValue("REMOVE_THE_RESOURCE_FROM_PAGE", "Remove the resource
from page");
+ portalSelectItems = new HashMap<Locale, List<SelectItem>>();
+ pageSelectItems = new HashMap<Locale, List<SelectItem>>();
}
- public List getPortalSelectItems()
+ public List<SelectItem> getPortalSelectItems()
{
- if (portalSelectItems == null)
+ Locale locale =
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ if (portalSelectItems.get(locale) == null)
{
- portalSelectItems = new ArrayList();
- portalSelectItems.add(new SelectItem(ControlConstants.IGNORE_CONTROL_VALUE,
DISPLAY_THE_DEFAULT_ERROR_MESSAGE));
- portalSelectItems.add(new SelectItem(ControlConstants.JSP_CONTROL_VALUE,
REDIRECT_TO_THE_SPECIFIED_RESOURCE));
+ List<SelectItem> list = new ArrayList<SelectItem>();
+ list.add(new SelectItem(ControlConstants.IGNORE_CONTROL_VALUE,
DISPLAY_THE_DEFAULT_ERROR_MESSAGE.getString(locale, true)));
+ list.add(new SelectItem(ControlConstants.JSP_CONTROL_VALUE,
REDIRECT_TO_THE_SPECIFIED_RESOURCE.getString(locale, true)));
+ portalSelectItems.put(locale, list);
}
- return portalSelectItems;
+ return portalSelectItems.get(locale);
}
- public List getPageSelectItems()
+ public List<SelectItem> getPageSelectItems()
{
- if (pageSelectItems == null)
+ Locale locale =
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ if (pageSelectItems.get(locale) == null)
{
- pageSelectItems = new ArrayList();
- pageSelectItems.add(new SelectItem(ControlConstants.IGNORE_CONTROL_VALUE,
DISPLAY_THE_DEFAULT_ERROR_MESSAGE));
- pageSelectItems.add(new SelectItem(ControlConstants.HIDE_CONTROL_VALUE,
REMOVE_THE_RESOURCE_FROM_PAGE));
- pageSelectItems.add(new SelectItem(ControlConstants.JSP_CONTROL_VALUE,
REDIRECT_TO_THE_SPECIFIED_RESOURCE));
+ List<SelectItem> list = new ArrayList<SelectItem>();
+ list.add(new SelectItem(ControlConstants.IGNORE_CONTROL_VALUE,
DISPLAY_THE_DEFAULT_ERROR_MESSAGE.getString(locale, true)));
+ list.add(new SelectItem(ControlConstants.HIDE_CONTROL_VALUE,
REMOVE_THE_RESOURCE_FROM_PAGE.getString(locale, true)));
+ list.add(new SelectItem(ControlConstants.JSP_CONTROL_VALUE,
REDIRECT_TO_THE_SPECIFIED_RESOURCE.getString(locale, true)));
+ pageSelectItems.put(locale, list);
}
- return pageSelectItems;
+ return pageSelectItems.get(locale);
}
private ControlPropertyBean grabProperty(String name)
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2008-06-02
13:22:58 UTC (rev 10901)
+++
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2008-06-02
13:46:10 UTC (rev 10902)
@@ -215,6 +215,9 @@
WIZARD_PORTLET_PROVIDER=Portlet provider
WIZARD_CHANGE=Change
+DISPLAY_THE_DEFAULT_ERROR_MESSAGE=Display the default error message
+REDIRECT_TO_THE_SPECIFIED_RESOURCE=Redirect to the specified resource
+REMOVE_THE_RESOURCE_FROM_PAGE=Remove the resource from page
THEME_LAYOUT_ID_NAME=Layout id
THEME_LAYOUT_ID_DESCRIPTION=The layout value formats a page
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties 2008-06-02
13:22:58 UTC (rev 10901)
+++
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties 2008-06-02
13:46:10 UTC (rev 10902)
@@ -215,6 +215,10 @@
WIZARD_PORTLET_PROVIDER=Fornitore di Portlet
WIZARD_CHANGE=Cambia
+DISPLAY_THE_DEFAULT_ERROR_MESSAGE=Visualizza il messaggio di errore di default
+REDIRECT_TO_THE_SPECIFIED_RESOURCE=Redireziona alla risorsa specificata
+REMOVE_THE_RESOURCE_FROM_PAGE=Rimuovi la risorsa dalla pagina
+
THEME_LAYOUT_ID_NAME=Id Layout
THEME_LAYOUT_ID_DESCRIPTION=Il valore del layout formatta la pagina
THEME_THEME_ID_NAME=Id Tema