portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html changeLanguage.vm
Date Wed, 26 Feb 2003 17:46:35 GMT
taylor      2003/02/26 09:46:35

  Modified:    src/java/org/apache/jetspeed/modules/actions
                        JetspeedSessionValidator.java
               src/java/org/apache/jetspeed/services/customlocalization
                        CustomLocalizationService.java
                        JetspeedLocalizationService.java
               webapp/WEB-INF/conf JetspeedSecurity.properties
                        TurbineResources.properties portlets.xreg
  Added:       webapp/WEB-INF/templates/vm/portlets/html changeLanguage.vm
  Log:
  ChangeLanguage portlet (finally) committed.
  Sorry about the delay.
  
  Revision  Changes    Path
  1.20      +7 -1      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java
  
  Index: JetspeedSessionValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JetspeedSessionValidator.java	28 Jun 2002 05:37:28 -0000	1.19
  +++ JetspeedSessionValidator.java	26 Feb 2003 17:46:33 -0000	1.20
  @@ -145,6 +145,12 @@
                          +"please verify the RunData factory settings");
               return;
           }
  +        String language = (String) data.getRequest().getParameter("js_language");
  +
  +        if (null != language) 
  +        {
  +            user.setPerm("language", language);
  +        }
           
           // Get the locale store it in the user object
           Locale locale = LocaleDetector.getLocale(data);
  
  
  
  1.2       +1 -1      jakarta-jetspeed/src/java/org/apache/jetspeed/services/customlocalization/CustomLocalizationService.java
  
  Index: CustomLocalizationService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/customlocalization/CustomLocalizationService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CustomLocalizationService.java	14 Nov 2002 20:30:24 -0000	1.1
  +++ CustomLocalizationService.java	26 Feb 2003 17:46:34 -0000	1.2
  @@ -79,5 +79,5 @@
       public abstract String getString(String s, Locale locale, String s1);
   
       public static final String SERVICE_NAME = "LocalizationService";
  -    public static final String ACCEPT_LANGUAGE = "accept-Language";
  +    public static final String ACCEPT_LANGUAGE = "Accept-Language";
   }
  
  
  
  1.4       +46 -46    jakarta-jetspeed/src/java/org/apache/jetspeed/services/customlocalization/JetspeedLocalizationService.java
  
  Index: JetspeedLocalizationService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/customlocalization/JetspeedLocalizationService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedLocalizationService.java	16 Nov 2002 17:30:31 -0000	1.3
  +++ JetspeedLocalizationService.java	26 Feb 2003 17:46:34 -0000	1.4
  @@ -90,31 +90,31 @@
   
       protected void initBundleNames(String ignored[])
       {
  -      bundleNames = TurbineResources.getStringArray("locale.default.bundles");
  -      String name = TurbineResources.getString("locale.default.bundle");
  -      if (name != null && name.length() > 0)
  -      {
  -          if (bundleNames == null || bundleNames.length <= 0)
  -          {
  +        bundleNames = TurbineResources.getStringArray("locale.default.bundles");
  +        String name = TurbineResources.getString("locale.default.bundle");
  +        if (name != null && name.length() > 0)
  +        {
  +            if (bundleNames == null || bundleNames.length <= 0)
  +            {
                 bundleNames = (new String[] {name});
  -          }
  -          else
  -          {
  +            }
  +            else
  +            {
                 String array[] = new String[bundleNames.length + 1];
                 array[0] = name;
                 System.arraycopy(bundleNames, 0, array, 1, bundleNames.length);
                 bundleNames = array;
  -          }
  -      }
  -      if (bundleNames == null)
  -      {
  -          bundleNames = new String[0];
  -      }
  +            }
  +        }
  +        if (bundleNames == null)
  +        {
  +            bundleNames = new String[0];
  +        }
       }
   
       public String getDefaultBundleName()
       {
  -      return bundleNames.length > 0 ? bundleNames[0] : "";
  +        return bundleNames.length > 0 ? bundleNames[0] : "";
       }
   
       public ResourceBundle getBundle()
  @@ -155,36 +155,35 @@
   
       public final Locale getLocale(RunData data)
       {
  -       JetspeedUser user = (JetspeedUser) data.getUser();
  -       if (user == null)
  -       {
  -         return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE));
  -       }
  -       else
  -       {
  -         String lang = "null";
  -
  -         try
  -         {
  -           if (user.getPerm("language") == null)
  -           {
  -             return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE));
  -           }
  -           else
  -           {
  -             lang = user.getPerm("language").toString();
  -             Locale locale = new Locale(lang, "");
  -             return locale;
  -           }
  -         }
  -         catch (Exception use)
  -         {
  -           return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE));
  -         }
  -       }
  +        JetspeedUser user = (JetspeedUser) data.getUser();
  +        if (user == null)
  +        {
  +            return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE));
  +        }
  +        else
  +        {
  +            String lang = "null";
  +
  +            try
  +            {
  +                if (user.getPerm("language") == null)
  +                {
  +                    return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE));
  +                }
  +                else
  +                {
  +                    lang = user.getPerm("language").toString();
  +                    Locale locale = new Locale(lang, "");
  +                    return locale;
  +                }
  +            }
  +            catch (Exception use)
  +            {
  +                return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE));
  +            }
  +        }
       }
   
  -
       public Locale getLocale(String header)
       {
           return super.getLocale(header);
  @@ -192,7 +191,7 @@
   
       public String getString(String bundleName, Locale locale, String key)
       {
  -      return super.getString(bundleName, locale, key);
  +        return super.getString(bundleName, locale, key);
       }
   
       private Hashtable bundles;
  @@ -200,4 +199,5 @@
       private Locale defaultLocale;
       private String defaultLanguage;
       private String defaultCountry;
  +
   }
  
  
  
  1.58      +0 -0      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties
  
  Index: JetspeedSecurity.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  
  
  
  1.68      +5 -3      jakarta-jetspeed/webapp/WEB-INF/conf/TurbineResources.properties
  
  Index: TurbineResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/TurbineResources.properties,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- TurbineResources.properties	19 Feb 2003 08:00:41 -0000	1.67
  +++ TurbineResources.properties	26 Feb 2003 17:46:34 -0000	1.68
  @@ -371,7 +371,8 @@
   services.RunDataService.classname=org.apache.jetspeed.services.rundata.JetspeedRunDataService
   services.ServletService.classname=org.apache.turbine.services.servlet.TurbineServletService
   services.AssemblerBrokerService.classname=org.apache.turbine.services.assemblerbroker.TurbineAssemblerBrokerService
  -services.LocalizationService.classname=org.apache.turbine.services.localization.TurbineLocalizationService
  +#services.LocalizationService.classname=org.apache.turbine.services.localization.TurbineLocalizationService
  +services.LocalizationService.classname=org.apache.jetspeed.services.customlocalization.JetspeedLocalizationService
   services.MimeTypeService.classname=org.apache.turbine.services.mimetype.TurbineMimeTypeService
   services.GlobalCacheService.classname=org.apache.turbine.services.cache.TurbineGlobalCacheService
   services.SchedulerService.classname=org.apache.turbine.services.schedule.TurbineSchedulerService
  @@ -537,7 +538,8 @@
   # jlink.ActionKey has been replaced by jslink.ActionKey
   tool.request.jlink=org.apache.jetspeed.util.template.JetspeedTemplateLink
   tool.request.jetspeed=org.apache.jetspeed.util.template.JetspeedTool
  -tool.request.l10n=org.apache.turbine.services.localization.LocalizationTool
  +#tool.request.l10n=org.apache.turbine.services.localization.LocalizationTool
  +tool.request.l10n=org.apache.jetspeed.services.customlocalization.CustomLocalizationTool
   #tool.request.jnavigation=org.apache.jetspeed.util.template.JetspeedTemplateNavigation
   tool.request.config=org.apache.jetspeed.services.resources.JetspeedResources
   
  
  
  
  1.34      +5 -5      jakarta-jetspeed/webapp/WEB-INF/conf/portlets.xreg
  
  Index: portlets.xreg
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/portlets.xreg,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- portlets.xreg	16 Dec 2002 02:33:28 -0000	1.33
  +++ portlets.xreg	26 Feb 2003 17:46:34 -0000	1.34
  @@ -191,15 +191,15 @@
           <url cachedOnURL="true"/>
       </portlet-entry>
   
  -    <portlet-entry name="ChangeLanguage" hidden="false" type="instance" application="false">
  -        <security-ref parent="default"/>
  +    <portlet-entry name="ChangeLanguage" hidden="false" type="ref" parent="Velocity"
application="false">
           <meta-info>
               <title>Change language portlet</title>
               <description>Change language portlet</description>
  -        </meta-info>
  -        <classname>org.apache.jetspeed.portal.portlets.language.ChangeLanguagePortlet</classname>
  +        </meta-info>                                          
  +        <parameter name="template" value="changeLanguage" hidden="true"/>
           <media-type ref="html"/>
  -        <url cachedOnURL="true"/>
  +        <category>velocity</category>
  +        <category>language</category>
       </portlet-entry>
   
       <portlet-entry name="LocalServletProxy" hidden="false" type="abstract" application="false">
  
  
  
  1.1                  jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/changeLanguage.vm
  
  Index: changeLanguage.vm
  ===================================================================
  <body bgcolor="#FFFFFF" text=#000000\>
  <a href="$jslink.addQueryData("js_language","it")">IT</a>
  <a href="$jslink.addQueryData("js_language","en")">EN</a>
  <a href="$jslink.addQueryData("js_language","es")">ES</a>
  <a href="$jslink.addQueryData("js_language","de")">DE</a>
  <a href="$jslink.addQueryData("js_language","fr")">FR</a>
  <a href="$jslink.addQueryData("js_language","no")">NO</a>
  <a href="$jslink.addQueryData("js_language","ja")">JA</a>
  <a href="$jslink.addQueryData("js_language","el")">EL</a>
  <a href="$jslink.addQueryData("js_language","nl")">NL</a>
  <a href="$jslink.addQueryData("js_language","my")">MY</a>
  </body></html>
  
  
  

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


Mime
View raw message