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 "Dahl, Sandra" <SD...@dvsAnalytics.com> on 2010/01/08 23:16:58 UTC

portlet internationalization

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?



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.



Thanks!

Sandi







________________________________
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.

Re: portlet internationalization

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Sandra,

I think you should use portlet-level resource bundle for portlet title. (Please see PLT.25.10 for differences between application-level and portlet-level resource bundles.)
So, you can move the resource-bundle element after supported-locale elements if you want to have different portlet titles.

Regards,

Woonsan




----- Original Message ----
> From: "Dahl, Sandra" <SD...@dvsAnalytics.com>
> To: Jetspeed Developers List <je...@portals.apache.org>
> Sent: Mon, January 11, 2010 4:27:11 PM
> Subject: RE: portlet internationalization
> 
> The property files are located in src\main\resources and deployed to 
> WEB-INF/classes. Portlet.xml:
> 
> 
>               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">
> 
>   LocalStrings
> 
>   
>     Richface portlet example
>     MyRichfacesPortlet
>     MyRichfacesPortlet Portlet
>         com.dvsinc.portlet.MyRichfacesPortlet
> 
>     
>       javax.portlet.faces.defaultViewId.edit
>       
>       /richfaces-portlet-edit.xhtml
>       
>     
> 
>     
>       javax.portlet.faces.defaultViewId.view
>       
>       /richfaces-portlet-view.xhtml
>       
>     
>     
>     
>                 javax.portlet.faces.preserveActionParams
>                 true
>         
>         -0
> 
>     
>       text/html
>       VIEW
>       EDIT
>       HELP
>     
>     en
>     fr
>     
> 
>       example, jsf, richfaces
>     
>     
>       
>         PageSize
>         0
>       
>     
> 
>   
> 
> 
> 
> 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:d.taylor@onehippo.com]
> 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 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:
> >
> > LocalStrings
> >
> > en
> >
> > fr
> >
> >
> >
> > The portlet uses JSF and the following is included in faces-config.xml:
> >
> > 
> >
> > en
> >
> > en
> >
> > fr
> >
> > 
> >
> >
> >
> > 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: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org



      

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


RE: portlet internationalization

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
That worked perfectly. I did not notice I had the bundle outside the portlet tags.

Thanks!

Sandi

-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com]
Sent: Monday, January 11, 2010 10:10 AM
To: Jetspeed Developers List
Subject: Re: portlet internationalization

On Mon, Jan 11, 2010 at 7:27 AM, Dahl, Sandra <SD...@dvsanalytics.com>wrote:

> 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>
>
> A minor issue, the resource-bundle tag should be placed after the <portlet>
collection tags
I agree with Woonsan, try using a portlet level tag, just move the
resource-bundle tag to here (to test if it works):




>
>    <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>
>
 <resource-bundle>LocalStrings</resource-bundle>


See if that works. In the mean time i will look into seeing if we have a bug
at the global <resource-bundle> tag level

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: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: portlet internationalization

Posted by David Sean Taylor <d....@onehippo.com>.
On Mon, Jan 11, 2010 at 7:27 AM, Dahl, Sandra <SD...@dvsanalytics.com>wrote:

> 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>
>
> A minor issue, the resource-bundle tag should be placed after the <portlet>
collection tags
I agree with Woonsan, try using a portlet level tag, just move the
resource-bundle tag to here (to test if it works):




>
>    <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>
>
 <resource-bundle>LocalStrings</resource-bundle>


See if that works. In the mean time i will look into seeing if we have a bug
at the global <resource-bundle> tag level

RE: portlet internationalization

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
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:d.taylor@onehippo.com]
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 <SD...@dvsanalytics.com> 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: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: portlet internationalization

Posted by David Sean Taylor <d....@onehippo.com>.
On Fri, Jan 8, 2010 at 2:16 PM, Dahl, Sandra <SD...@dvsanalytics.com> 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