The property files are located in src\main\resources and deployed to
WEB-INF/classes. Portlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<resource-bundle>LocalStrings</resource-bundle>
<portlet>
<description>Richface portlet example</description>
<portlet-name>MyRichfacesPortlet</portlet-name>
<display-name>MyRichfacesPortlet Portlet</display-name>
<portlet-class>com.dvsinc.portlet.MyRichfacesPortlet</portlet-class>
<!--
<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
-->
<init-param>
<name>javax.portlet.faces.defaultViewId.edit</name>
<!--
JSF/FACELETS: use *.xhtml template value for facelets, *.jsp for JSF
-->
<value>/richfaces-portlet-edit.xhtml</value>
<!--
<value>/richfaces-portlet-edit.jsp</value>
-->
</init-param>
<!--
<init-param>
<name>javax.portlet.faces.defaultViewId.help</name>
<value>/richfaces-portlet-help.xhtml</value>
</init-param>
-->
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<!--
JSF/FACELETS: use *.xhtml template value for facelets, *.jsp for JSF
-->
<value>/richfaces-portlet-view.xhtml</value>
<!--
<value>/richfaces-portlet-view.jsp</value>
-->
</init-param>
<!-- Richfaces parms that cause portlets to not start -->
<init-param>
<name>javax.portlet.faces.preserveActionParams</name>
<value>true</value>
</init-param>
<expiration-cache>-0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>EDIT</portlet-mode>
<portlet-mode>HELP</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
<portlet-info>
<!--
<title>My Richfaces Portlet</title>
<short-title>My Richfaces Portlet</short-title>
-->
<keywords>example, jsf, richfaces</keywords>
</portlet-info>
<portlet-preferences>
<preference>
<name>PageSize</name>
<value>0</value>
</preference>
</portlet-preferences>
</portlet>
</portlet-app>
On the browser refresh, logging out/in does update the portal to the currently
selected language.
Thanks!
Sandi
-----Original Message-----
From: David Sean Taylor [mailto:[email protected]]
Sent: Saturday, January 09, 2010 8:53 AM
To: Jetspeed Developers List
Subject: Re: portlet internationalization
On Fri, Jan 8, 2010 at 2:16 PM, Dahl, Sandra <[email protected]> wrote:
> I'm using Jetspeed 2 and am trying to set the locale for portlets and have
> a couple questions. First, I want the title to be loaded from a resource
> bundle. The following is included in LocalStrings.properties:
>
> javax.portlet.title=Richfaces Internationalization Portlet
>
> javax.portlet.short-title=Ruichfaces Intl
>
> javax.portlet.keywords=richfaces,portlet
>
>
>
> The resource bundle is declared in portlet.xml along with the allowed
> locales:
>
> <resource-bundle>LocalStrings</resource-bundle>
>
> <supported-locale>en</supported-locale>
>
> <supported-locale>fr</supported-locale>
>
>
>
> The portlet uses JSF and the following is included in faces-config.xml:
>
> <locale-config>
>
> <default-locale>en</default-locale>
>
> <supported-locale>en</supported-locale>
>
> <supported-locale>fr</supported-locale>
>
> </locale-config>
>
>
>
> The portlet title is not displayed from the resource bundle. If there no
> title is included in portlet.xml, no title is displayed in Jetspeed. Am I
> missing a setting?
>
Does't look like a setting is missing, although send me the entire
portlet.xml so I can make sure. Also, where are your localized property
files located? Are they in the root package ?
>
>
>
> Second question. When the language is changed in the browser and the portal
> page is reloaed, the new language is not displayed. A new browser window
> needs to be opened for the changes to appear. Is this how it is supposed to
> work? I noticed google updates the language when the browser is refreshed.
>
> Changing the language using the Jetspeed Language portlet will change
portlet content immediately. As for changing the language in your browser,
that should take place immediately although we might be optimizing the
setting and caching it. See if logging out and logging back in makes a
difference
Confidentiality Notice:
The information contained in this communication, including attachments, is
privileged and confidential. It is intended only for the exclusive use of the
addressee. If the reader is not the intended recipient, or the employee, or
the agent responsible for delivering it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this communication
in error, please notify us by return email or telephone immediately. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]