User: pazu    
  Date: 02/06/27 22:34:52

  Modified:    modules/xdoclet/src/xdoclet/modules/externalizer
                        ExternalizerSubTask.java
  Log:
  Some nasty bugs and typos corrected. Now the externalizer is correctly generating
  property files for non-default locales. Changes details:
  
  - Changed all spellings of 'varient' to 'variant'
  - Corrected order of Combination constructor arguments
  - Prepends a underline to combination name if it's a non-default locale
    (so it generates the correct file name)
  
  Revision  Changes    Path
  1.7       +16 -13    
xdoclet/modules/xdoclet/src/xdoclet/modules/externalizer/ExternalizerSubTask.java
  
  Index: ExternalizerSubTask.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdoclet/modules/xdoclet/src/xdoclet/modules/externalizer/ExternalizerSubTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- ExternalizerSubTask.java  12 Jun 2002 23:27:47 -0000      1.6
  +++ ExternalizerSubTask.java  28 Jun 2002 05:34:52 -0000      1.7
  @@ -17,13 +17,13 @@
   /**
    * Externalizes key-value paired tags to whatever configured file (be it xml or 
properties file). It's useful for simple
    * key-value properties or xml files. For now only properties files are supported. 
It supports i18n and l10n, so
  - * generated files follow ResourceBundle naming convention. Parameters "language", 
"country" and "varient" are reserved
  + * generated files follow ResourceBundle naming convention. Parameters "language", 
"country" and "variant" are reserved
    * and used for this purpose.
    *
    * @author        Ara Abrahamian ([EMAIL PROTECTED])
    * @created       May 7, 2002
    * @ant.element   display-name="Externalizer" name="externalizer" 
parent="xdoclet.DocletTask"
  - * @version       $Revision: 1.6 $
  + * @version       $Revision: 1.7 $
    */
   public class ExternalizerSubTask extends TemplateSubTask
   {
  @@ -133,12 +133,12 @@
                       XTag tag = tags[i];
                       String language = tag.getAttributeValue("language");
                       String country = tag.getAttributeValue("country");
  -                    String varient = tag.getAttributeValue("varient");
  -                    String combination_name = language + country + varient;
  +                    String variant = tag.getAttributeValue("variant");
  +                    String combination_name = language + country + variant;
                       Combination combination = (Combination) 
combinations.get(combination_name);
   
                       if (combination == null) {
  -                        combination = new Combination(language, country, varient);
  +                        combination = new Combination(language, country, variant);
   
                           combinations.put(combination_name, combination);
                       }
  @@ -157,15 +157,15 @@
       {
           public String language;
           public String country;
  -        public String varient;
  +        public String variant;
           public List keys = new ArrayList();
           public List values = new ArrayList();
   
  -        public Combination(String country, String language, String varient)
  +        public Combination(String language, String country, String variant)
           {
               this.country = country;
               this.language = language;
  -            this.varient = varient;
  +            this.variant = variant;
           }
   
           public String getCombinationNameAsResourceBundleName()
  @@ -181,17 +181,20 @@
                   name += country;
               }
   
  -            if (varient != null) {
  +            if (variant != null) {
                   name += "_";
  -                name += varient;
  +                name += variant;
               }
   
  +            if (name.length() > 0)
  +                return "_" + name;
  +            else
               return name;
           }
   
           public int hashCode()
           {
  -            return (language + country + varient).hashCode();
  +            return (language + country + variant).hashCode();
           }
   
           public boolean equals(Object obj)
  @@ -203,7 +206,7 @@
   
               return this.language.equals(other_combination.language) &&
                   this.country.equals(other_combination.country) &&
  -                this.varient.equals(other_combination.varient);
  +                this.variant.equals(other_combination.variant);
           }
       }
   }
  
  
  


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to