kpiroumian    02/04/27 02:40:38

  Modified:    src/java/org/apache/cocoon/transformation
                        I18nTransformer.java
  Log:
  Fixed number formatting
  PR:7726
  Submitted by: Michael Enke ([EMAIL PROTECTED])
  
  Revision  Changes    Path
  1.16      +6 -3      
xml-cocoon2/src/java/org/apache/cocoon/transformation/I18nTransformer.java
  
  Index: I18nTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/I18nTransformer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- I18nTransformer.java      25 Apr 2002 16:24:37 -0000      1.15
  +++ I18nTransformer.java      27 Apr 2002 09:40:38 -0000      1.16
  @@ -224,7 +224,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marcus Crafter</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Michael Enke</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Lassi Immonen</a>
  - * @version CVS $Id: I18nTransformer.java,v 1.15 2002/04/25 16:24:37 kpiroumian Exp 
$
  + * @version CVS $Id: I18nTransformer.java,v 1.16 2002/04/27 09:40:38 kpiroumian Exp 
$
    *
    * @todo Move all formatting/parsing routines to I18nUtils
    */
  @@ -1438,7 +1438,7 @@
           char dec = from_fmt.getDecimalFormatSymbols().getDecimalSeparator();
           int decAt = 0;
           boolean appendDec = false;
  -        if (type == null) {
  +        if (type == null || type.equals( I18N_NUMBER_ELEMENT )) {
               to_fmt = (DecimalFormat)NumberFormat.getInstance(loc);
               to_fmt.setMaximumFractionDigits(309);
               for (int i = value.length() - 1;
  @@ -1481,7 +1481,10 @@
               to_fmt.setMaximumFractionDigits(tmp.getMaximumFractionDigits());
           } else if (type.equals( I18N_PERCENT_ELEMENT )) {
               to_fmt = (DecimalFormat)NumberFormat.getPercentInstance(loc);
  -        }
  +        } else {
  +            throw new SAXException("&lt;i18n:number>: unknown type: " + type);
  +     }
  +
   
           if(fractionDigits > -1) {
               to_fmt.setMinimumFractionDigits(fractionDigits);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to