Attached to the mail is the new version portlet to
change the language with a servlet filter, the turbine
resources.prop to enable the jetspeed Localization
Service and localization tool and a diagram to explain
the flow.
I have modified the Localization service only to
change the language witout the browser role (language
header).
The language changes at runtime.
I don't understand your problem with the change
language.
Test this file and send a feedback to me ,
in this way i can help you

Massimiliano


 --- Jon Evans <[EMAIL PROTECTED]> ha scritto: > Hi
David,
> 
> David Sean Taylor wrote:
> 
> > The patch isn't necessary I just committed a patch
> from
> > Missimilliano Dessi. It works fine as is. Although
> I thought we had
> > country flag icons with the original portlet.
> 
> I have just got round to using the latest CVS.  I
> like the fact that
> the changeLanguage portlet is now a .vm, it will
> make it a lot easier
> to change the look and feel for my site.
> 
> I'm still concerned though with
>
org.apache.jetspeed.services.customlocalization.JetspeedLocalizationService.
> 
> It still doesn't seem to work if you have more than
> one bundle defined
> in locale.default.bundles.  It only seems to look at
> the first bundle.
> 
> If you look at the class, it extends
> TurbineLocalizationService.
> JetspeedLocalizationService implements an
> initBundleNames() method
> which populates an instance variable String[]
> bundleNames.  But all of
> the getString(...) methods call
> super.getString(...), where
> TurbineLocalizationService will use its own instance
> variables and will
> not find the strings.
> 
> 
> Let me put it another way.  Each class defines an
> identical set of 
> instance variables, like this:
> 
> JetspeedLocalizationService    
> TurbineLocalizationService
> ===============================
> ===============================
> private Hashtable bundles;      private Hashtable
> bundles;
> private String bundleNames[];   private String
> bundleNames[];
> private Locale defaultLocale;   private Locale
> defaultLocale;
> private String defaultLanguage; private String
> defaultLanguage;
> private String defaultCountry;  private String
> defaultCountry;
> 
> After JetspeedLocalizationService.init() is called
> they look like this:
> 
> JetspeedLocalizationService
> TurbineLocalizationService
> ===========================
> ==========================
> bundles          null       bundles         set
> bundleNames[]    set        bundleNames[]   null
> defaultLocale    null       defaultLocale   set
> defaultLanguage  null       defaultLanguage set
> defaultCountry   null       defaultCountry  set
> 
> when getString(String bundleName, Locale locale,
> String key) is called
> in JetspeedLocalizationService, it calls
> super.getString(...).  This
> calls getBundle(String, Locale), which is
> implemented in
> JetspeedLocalizationService as a call to
> super.getBundle(String,
> Locale), so we are back to the code in
> TurbineLocalizationService.
> 
> getBundle(String, Locale) in
> TurbineLocalizationService returns the
> default bundle to the getString(...) method.
> 
> Back in getString(String bundleName, Locale locale,
> String key), we
> look up the requested key in the bundle, using
> getStringOrNull(), which 
> returns null because the string I'm looking for
> isn't in the first 
> bundle, it's in the second.
> 
> The next test is intended to determine whether we
> need to check the
> other bundles for the key.  The test is:
> 
>          // Look for text in list of default
> bundles.
>          if (value == null && bundleNames.length >
> 0)
> 
> At this point we throw a NullPointerException
> because bundleNames is
> null (it was never set in
> TurbineLocalizationService, only in
> JetspeedLocalizationService).
> 
> The whole of the JetspeedLocalizationService class
> can be reduced to a 
> single function, getLocale(RunData runData).
> 
> The attached patch does this, and seems to work. 
> Yes, I compiled from 
> clean this time. :-)
> 
> Jon
>  
>  
>  
>  
>  
> -- 
>  
> Merlin Information Systems Limited, 
>  
> Merlin House, Gawcott Road, Buckingham, United
> Kingdom. MK18 1TN
>  
> Tel: +44 (0) 1280 824331  Fax: +44 (0) 1280 824112
>  
> 
>  
> http://www.misgl.com
>  
> Provider of IT Services and Online Portal Support
> Services. 
>  
>  
>  
> Confidentiality:
>  
> The information contained in this email (including
> any attachments) is confidential and is intended
> solely for the use of the named addressee. Access,
> copying or re-use of the information in it by any
> other person is not authorised. If you are not the
> intended recipient, please notify us immediately by
> telephone or by e-mail to [EMAIL PROTECTED]
>  
> 
>  
>  
>  
> *** This mail has been scanned for viruses ***
>  
> 
>  
> > Index:
>
src/java/org/apache/jetspeed/services/customlocalization/JetspeedLocalizationService.java
>
===================================================================
> RCS file:
>
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/services/customlocalization/JetspeedLocalizationService.java,v
> retrieving revision 1.4
> diff -u -r1.4 JetspeedLocalizationService.java
> ---
>
src/java/org/apache/jetspeed/services/customlocalization/JetspeedLocalizationService.java
> 26 Feb 2003 17:46:34 -0000    1.4
> +++
>
src/java/org/apache/jetspeed/services/customlocalization/JetspeedLocalizationService.java
> 4 Mar 2003 12:49:37 -0000
> @@ -62,14 +62,10 @@
>   */
>  
>  // Java imports
> -import java.util.Hashtable;
>  import java.util.Locale;
> -import java.util.ResourceBundle;
>  
>  // Turbine imports
>  import
>
org.apache.turbine.services.localization.TurbineLocalizationService;
> -import
> org.apache.turbine.services.InitializationException;
> -import
>
org.apache.turbine.services.resources.TurbineResources;
>  import org.apache.turbine.util.RunData;
>  
>  // Jetspeed imports
> @@ -78,81 +74,6 @@
>  
>  public class JetspeedLocalizationService extends
> TurbineLocalizationService implements
> CustomLocalizationService
>  {
> -    public JetspeedLocalizationService()
> -    {
> -        super();
> -    }
> -
> -    public void init() throws
> InitializationException
> -    {
> -        super.init();
> -    }
> -
> -    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 = (new String[] {name});
> -            }
> -            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];
> -        }
> -    }
> -
> -    public String getDefaultBundleName()
> -    {
> -        return bundleNames.length > 0 ?
> bundleNames[0] : "";
> -    }
> -
> -    public ResourceBundle getBundle()
> -    {
> -        return super.getBundle();
> -    }
> -
> -    public ResourceBundle getBundle(String
> bundleName)
> -    {
> -        return super.getBundle(bundleName);
> -    }
> -
> -    public ResourceBundle getBundle(String
> bundleName, String languageHeader)
> -    {
> -      return super.getBundle(bundleName,
> languageHeader);
> -    }
> -
> -    public ResourceBundle getBundle(RunData data)
> -    {
> -      return super.getBundle(data);
> -    }
> -
> -    public ResourceBundle getBundle(String
> bundleName, RunData data)
> -    {
> -      return super.getBundle(bundleName, data);
> -    }
> -
> -    public ResourceBundle getBundle(String
> bundleName, Locale locale)
> -    {
> -     return super.getBundle(bundleName, locale);
> -    }
> -
> -    public void setBundle(String defaultBundle)
> -    {
> -      super.setBundle(defaultBundle);
> -    }
> -
> -
>      public final Locale getLocale(RunData data)
>      {
>          JetspeedUser user = (JetspeedUser)
> data.getUser();
> @@ -183,21 +104,4 @@
>              }
>          }
>      }
> -
> -    public Locale getLocale(String header)
> -    {
> -        return super.getLocale(header);
> -    }
> -
> -    public String getString(String bundleName,
> Locale locale, String key)
> -    {
> -        return super.getString(bundleName, locale,
> key);
> -    }
> -
> -    private Hashtable bundles;
> -    private String bundleNames[];
> -    private Locale defaultLocale;
> -    private String defaultLanguage;
> -    private String defaultCountry;
> -
> -}
> +}
> \ No newline at end of file
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED] 

______________________________________________________________________
Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino
http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html

Attachment: changeLanguagePortletPack.zip
Description: changeLanguagePortletPack.zip

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to