You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2003/03/16 17:02:12 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/tiles/xmlDefinition I18nFactorySet.java

husted      2003/03/16 08:02:11

  Modified:    src/share/org/apache/struts/tiles/xmlDefinition
                        I18nFactorySet.java
  Log:
  Update per ticket #17389 by Jeremy Tan. I spliced in the I18nFactorySet.calculatePostixes from the attachment, rebuild, and ran the unit tests successfully.
  
  Revision  Changes    Path
  1.7       +26 -14    jakarta-struts/src/share/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java
  
  Index: I18nFactorySet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- I18nFactorySet.java	27 Feb 2003 19:19:42 -0000	1.6
  +++ I18nFactorySet.java	16 Mar 2003 16:02:11 -0000	1.7
  @@ -406,11 +406,10 @@
   
       /**
        * Calculate the postixes along the search path from the base bundle to the
  -     * bundle specified by <code>baseName</code> and <code>locale</code>.
  -     * Method copied from java.util.ResourceBundle.
  -     * @param baseName The base bundle name.
  -     * @param locale The locale.
  -     * @return List containing postixes.
  +     * bundle specified by baseName and locale.
  +     * Method copied from java.util.ResourceBundle
  +     * @param baseName the base bundle name
  +     * @param locale the locale
        */
       private static List calculatePostixes(String baseName, Locale locale) {
           final List result = new ArrayList(MAX_BUNDLES_SEARCHED);
  @@ -418,24 +417,37 @@
           final int languageLength = language.length();
           final String country = locale.getCountry();
           final int countryLength = country.length();
  +        final String variant = locale.getVariant();
  +        final int variantLength = variant.length();
   
  -        if (languageLength + countryLength == 0) {
  +        if (languageLength + countryLength + variantLength == 0) {
               //The locale is "", "", "".
               return result;
           }
           final StringBuffer temp = new StringBuffer(baseName);
           temp.append('_');
           temp.append(language);
  -        result.add(temp.toString());
   
  -        if (countryLength == 0) {
  +        if(languageLength > 0)
  +            result.add(temp.toString());
  +
  +        if (countryLength + variantLength == 0)
               return result;
  -        }
  +
           temp.append('_');
           temp.append(country);
  -        result.add(temp.toString());
   
  -        return result;
  +        if(countryLength > 0)
  +            result.add(temp.toString());
  +
  +        if(variantLength == 0) {
  +            return result;
  +        } else {
  +            temp.append('_');
  +            temp.append(variant);
  +            result.add(temp.toString());
  +            return result;
  +        }
       }
   
       /**
  
  
  

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