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/05 06:49:04 UTC

cvs commit: jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF hello.jsp

taylor      2004/08/04 21:49:04

  Modified:    applications/demo/src/webapp/WEB-INF hello.jsp
  Added:       applications/localeselector/src/webapp/WEB-INF portlet.xml
                        web.xml jetspeed-portlet.xml portlet.tld
               applications/localeselector/xdocs navigation.xml
               applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector/resources
                        LocaleSelectorResources.properties
                        LocaleSelectorResources_ja.properties
                        LocaleSelectorResources_en.properties
               applications/localeselector project.xml maven.xml
                        project.properties
               applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector
                        LocaleSelectorPortlet.java
               applications/localeselector/src/webapp/WEB-INF/view
                        locale-list.jsp
  Log:
  Locale Selector portlet, contributed by Shinsuke Sugaya
  This porlet works much like the Locale portlet in J1
  You choose a language and it overrides the language for this session
  Right now we don't have any portlets with more than just english
  We are working on getting some multi-lingual example portlets soon
  
  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.1                  jakarta-jetspeed-2/applications/localeselector/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <portlet-app id="localeselector" version="1.0">
  
  <portlet id="LocaleSelector">
      <portlet-name>LocaleSelector</portlet-name>
      <display-name>Locale Selector</display-name>
      <description>Locale Selector is a portlet to select your preferred locale</description>
      <portlet-class>org.apache.jetspeed.portlets.localeselector.LocaleSelectorPortlet</portlet-class>
      <expiration-cache>-1</expiration-cache>
      <supports>
        <mime-type>text/html</mime-type>
        <portlet-mode>VIEW</portlet-mode>
        <portlet-mode>HELP</portlet-mode>
      </supports>
      <portlet-info>
        <title>Locale Selector</title>
        <short-title>This is a portlet to select your preferred locale</short-title>
        <keywords>Locale,Language</keywords>
      </portlet-info>
  </portlet>
  
  </portlet-app>
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                           "http://java.sun.com/dtd/web-app_2_3.dtd">
  <web-app>
    <display-name>Locale Selector Portlet</display-name>
    <description>Locale Selector Portlet</description>
  
  
  
  </web-app>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/webapp/WEB-INF/jetspeed-portlet.xml
  
  Index: jetspeed-portlet.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <portlet-app id="security" version="1.0" 
      xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" 
      xmlns:js="http://portals.apache.org/jetspeed" 
      xmlns:dc="http://www.purl.org/dc">
      
      <dc:title>Locale Selector Portlets</dc:title>
      <dc:title xml:lang="en">Locale Selector Portlets</dc:title>
      <dc:title xml:lang="ja">ロケール選択ポートレット</dc:title>
      <dc:creator>J2 Team</dc:creator>
      
      <portlet>
          <portlet-name>LocaleSelectorPortlet</portlet-name>
          <dc:title>Locale Selector Portlet</dc:title>
          <dc:creator>J2 Team</dc:creator>
      </portlet>
  
  	<js:services>
  		<js:service name='PortletRegistryComponent'/>
  	</js:services>
  	
  </portlet-app>
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/webapp/WEB-INF/portlet.tld
  
  Index: portlet.tld
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" ?>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <!DOCTYPE taglib PUBLIC
    "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
  <taglib>
      <tlibversion>1.0</tlibversion>
      <jspversion>1.1</jspversion>
      <shortname>Tags for portlets</shortname>
      <tag>
          <name>defineObjects</name>
          <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
          <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
          <bodycontent>empty</bodycontent>
      </tag>
      <tag>
          <name>param</name>
          <tagclass>org.apache.pluto.tags.ParamTag</tagclass>
          <bodycontent>empty</bodycontent>
          <attribute>
              <name>name</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>value</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
      </tag>
      <tag>
          <name>actionURL</name>
          <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
          <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
          <bodycontent>JSP</bodycontent>
          <attribute>
              <name>windowState</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>portletMode</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>secure</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
      </tag>
      <tag>
          <name>renderURL</name>
          <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
          <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
          <bodycontent>JSP</bodycontent>
          <attribute>
              <name>windowState</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>portletMode</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>secure</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
      </tag>
      <tag>
          <name>namespace</name>
          <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
          <bodycontent>empty</bodycontent>
      </tag>
  </taglib>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/xdocs/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <project>
    <body>
      <links>
        <item name="Jetspeed 2" href="../../index.html"/>
      </links>
    </body>
  </project>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties
  
  Index: LocaleSelectorResources.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources.properties,v 1.1 2004/08/05 04:49:04 taylor Exp $
  #
  
  # Base Locales
  # DO NOT TRANSLATE & DO NOT INCLUDE IN L10N PROPERTIES FILE
  localeselector.locales=de,en,es,fr,it,ja,ko,sv,zh,zh_TW
  
  # Label
  localeselector.label.language=Language:
  localeselector.label.change=Change
  
  # Locale Name
  localeselector.locale.de=German
  localeselector.locale.en=English
  localeselector.locale.es=Spanish
  localeselector.locale.fr=French
  localeselector.locale.it=Italian
  localeselector.locale.ja=Japanese
  localeselector.locale.ko=Korean
  localeselector.locale.sv=Swedish
  localeselector.locale.zh=Simplified Chinese
  localeselector.locale.zh_TW=Traditional Chinese
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ja.properties
  
  Index: LocaleSelectorResources_ja.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_ja.properties,v 1.1 2004/08/05 04:49:04 taylor Exp $
  #
  
  # Label
  localeselector.label.language=\u8A00\u8A9E:
  localeselector.label.change=\u5909\u66F4
  
  # Locale Name
  localeselector.locale.de=\u30C9\u30A4\u30C4\u8A9E
  localeselector.locale.en=\u82F1\u8A9E
  localeselector.locale.es=\u30B9\u30DA\u30A4\u30F3\u8A9E
  localeselector.locale.fr=\u30D5\u30E9\u30F3\u30B9\u8A9E
  localeselector.locale.it=\u30A4\u30BF\u30EA\u30A2\u8A9E
  localeselector.locale.ja=\u65E5\u672C\u8A9E
  localeselector.locale.ko=\u97D3\u56FD\u8A9E
  localeselector.locale.sv=\u30B9\u30A6\u30A7\u30FC\u30C7\u30F3\u8A9E
  localeselector.locale.zh=\u7C21\u4F53\u5B57\u4E2D\u56FD\u8A9E
  localeselector.locale.zh_TW=\u7E41\u4F53\u5B57\u4E2D\u56FD\u8A9E
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_en.properties
  
  Index: LocaleSelectorResources_en.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_en.properties,v 1.1 2004/08/05 04:49:04 taylor Exp $
  #
  
  # Label
  localeselector.label.language=Language:
  localeselector.label.change=Change
  
  # Locale Name
  localeselector.locale.de=German
  localeselector.locale.en=English
  localeselector.locale.es=Spanish
  localeselector.locale.fr=French
  localeselector.locale.it=Italian
  localeselector.locale.ja=Japanese
  localeselector.locale.ko=Korean
  localeselector.locale.sv=Swedish
  localeselector.locale.zh=Simplified Chinese
  localeselector.locale.zh_TW=Traditional Chinese
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
    $Id: project.xml,v 1.1 2004/08/05 04:49:04 taylor Exp $
  -->
  <project>
    <extend>${basedir}/./../project.xml</extend>
    <id>localeselector</id>
    <name>Jetspeed-2 Language Selector Portlet</name>
    <description>Jetspeed-2 Language Selector Portlet</description>
    <shortDescription>Language Selector Portlet</shortDescription>
  
    <repository>                 
      <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-jetspeed-2/applications/localeselector</connection>
      <url>http://cvs.apache.org/viewcvs/jakarta-jetspeed-2/applications/localeselector/</url>
    </repository>
  
    <dependencies>
       <dependency>
        <id>jetspeed2:jetspeed-api</id>
        <version>2.0-a1-dev</version>
        <properties>
          <war.bundle>false</war.bundle>
        </properties>
      </dependency>
      <dependency>
        <id>pluto</id>
        <version>1.0.1-SNAPSHOT</version>
        <properties>
          <war.bundle>false</war.bundle>
        </properties>
      </dependency>
        
        <dependency>
        <id>portlet-api</id>
        <groupId>portlet-api</groupId>
        <version>1.0</version>
        <properties>
          <war.bundle>false</war.bundle>
        </properties>
      </dependency>
      <dependency>
        <id>jstl</id>
        <version>1.0.2</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>
      </dependency>
      <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.0.4</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>
      </dependency>
      <dependency>
        <id>servletapi</id>
        <version>2.3</version>
        <properties>
          <war.bundle>false</war.bundle>
        </properties> 
      </dependency>
      <dependency>
        <id>jetspeed-commons</id>
        <groupId>jetspeed2</groupId>
        <version>2.0-a1-dev</version>
        <properties>
          <war.bundle>false</war.bundle>
        </properties>
      </dependency>
      
       <!--
        <dependency>
        <id>veltag</id>
        <groupId>velocity</groupId>
        <version>0.01-dev</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>
       </dependency>      
      -->
     </dependencies>
  
  
    <build>
      <sourceDirectory>src/java</sourceDirectory>
      <resources>
        <resource>
          <directory>${basedir}/src/java/</directory>
          <includes>
            <include>**/*.properties</include>
          </includes>
        </resource>
      </resources>
    </build>
  
    <reports>
      <report>maven-jdepend-plugin</report>
  <!--
      <report>maven-checkstyle-plugin</report>
  -->
      <report>maven-pmd-plugin</report>
      <report>maven-changelog-plugin</report>
      <report>maven-file-activity-plugin</report>
      <report>maven-developer-activity-plugin</report>
      <report>maven-license-plugin</report>
      <report>maven-javadoc-plugin</report>
      <report>maven-jxr-plugin</report>
      <report>maven-junit-report-plugin</report>
      <report>maven-linkcheck-plugin</report>
      <report>maven-tasklist-plugin</report>
    </reports>  
  </project>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project default="java:jar"
           xmlns:j="jelly:core"
           xmlns:define="jelly:define">
  
  
    <!-- ================================================================ -->
    <!-- Hot Deploy for mundane everyday development under Catalina       -->
    <!-- ================================================================ -->
    <goal name="hotdeploy">
      <echo message="Hot Deploying ${org.apache.jetspeed.portlet.app.name} to ${org.apache.jetspeed.deploy.war.dir}"/>
      <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/WEB-INF/classes">
          <fileset dir="${maven.build.dir}/classes">
          </fileset>
      </copy>
      <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/">
        <fileset dir="./src/webapp"/>
      </copy>
    </goal>
  
    <preGoal name="hotdeploy">
     <attainGoal name= "java:compile"/>
    </preGoal>
  
  </project>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/project.properties
  
  Index: project.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: project.properties,v 1.1 2004/08/05 04:49:04 taylor Exp $
  #
  
  maven.multiproject.type=war
  
  org.apache.jetspeed.portlet.app.name=localeselector
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
  
  Index: LocaleSelectorPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.portlets.localeselector;
  
  import java.io.IOException;
  import java.util.Locale;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.GenericPortlet;
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletContext;
  import javax.portlet.PortletException;
  import javax.portlet.PortletRequestDispatcher;
  import javax.portlet.PortletSession;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  /**
   * 
   * 
   * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
   */
  public class LocaleSelectorPortlet extends GenericPortlet
  {
      public static final String PREFERED_LOCALE_SESSION_KEY = "org.apache.jetspeed.prefered.locale";
  
      /* (non-Javadoc)
       * @see javax.portlet.Portlet#init(javax.portlet.PortletConfig)
       */
      public void init(PortletConfig config) throws PortletException
      {
          super.init(config);
      }
  
      /* (non-Javadoc)
       * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
       */
      protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
      {
          PortletContext context = getPortletContext();
  
          Locale locale = request.getLocale();
          if (locale == null)
          {
              locale = Locale.getDefault();
          }
          request.setAttribute("currentLocale", locale.toString());
  
          PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/view/locale-list.jsp");
          rd.include(request, response);
      }
  
      /* (non-Javadoc)
       * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
       */
      public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException
      {
  
          PortletSession session = request.getPortletSession();
          String language = request.getParameter(PREFERED_LOCALE_SESSION_KEY);
  
          if (language != null)
          {
              String country = "";
              String variant = "";
              int countryIndex = language.indexOf('_');
              if (countryIndex > -1)
              {
                  country = language.substring(countryIndex + 1).trim();
                  language = language.substring(0, countryIndex).trim();
                  int vDash = country.indexOf("_");
                  if (vDash > 0)
                  {
                      String cTemp = country.substring(0, vDash);
                      variant = country.substring(vDash + 1);
                      country = cTemp;
                  }
              }
  
              // TODO Set the prefered locale to user's persistent storage if not anon user
  
              session.setAttribute(PREFERED_LOCALE_SESSION_KEY, new Locale(language, country, variant),PortletSession.APPLICATION_SCOPE);
          }
  
          return;
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/localeselector/src/webapp/WEB-INF/view/locale-list.jsp
  
  Index: locale-list.jsp
  ===================================================================
  <%--
  Copyright 2004 The Apache Software Foundation
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  --%>
  <%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
  <%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
  <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
  <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
  <c:set var="currentLocale"><%= request.getAttribute("currentLocale") %></c:set>
  <fmt:setBundle basename="org.apache.jetspeed.portlets.localeselector.resources.LocaleSelectorResources" />
  
  <portlet:actionURL var="changeLocaleAction">
  </portlet:actionURL>
  
  <form action="<%=changeLocaleAction%>" method="POST">
  <table border="0">
  	<tr>
  		<td align="right"><fmt:message key="localeselector.label.language"/></td>
  		<td align="left">
  			<select name="org.apache.jetspeed.prefered.locale">
  				<c:set var="locales"><fmt:message key="localeselector.locales"/></c:set>
  				<c:forTokens var="l" items="${locales}" delims=",">
  				<option value="<c:out value="${l}"/>"
  					<c:if test="${currentLocale == l}">selected</c:if>
  				><fmt:message>localeselector.locale.<c:out value="${l}"/></fmt:message></option>
  				</c:forTokens>
  			</select>
  		</td>
  	</tr>
  	<tr>
  		<td align="center" colspan="2"><input type="submit" value="<fmt:message key="localeselector.label.change"/>"/></td>
  	</tr>
  </table>
  </form>
  
  
  
  1.11      +3 -0      jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/hello.jsp
  
  Index: hello.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/hello.jsp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- hello.jsp	21 Jul 2004 19:00:20 -0000	1.10
  +++ hello.jsp	5 Aug 2004 04:49:04 -0000	1.11
  @@ -35,6 +35,9 @@
   <a href="/jetspeed/portal/perl-portlet">Perl Portlets</a>
   </p>
   <p>
  +<a href="/jetspeed/portal/localeselector">Locale Selector</a>
  +</p>
  +<p>
   Portlet Mode is <b><%= renderRequest.getPortletMode().toString() %></b> <br/>
   Window State is <b><%= renderRequest.getWindowState().toString() %></b> <br/>
   </p>
  
  
  

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