]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/msgfmt.cpp
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / msgfmt.cpp
index 32d9bc7d35daed99a071f5f4fe6ba83362612cd0..1fe2c8d622e04be9dfba3bb2fb6511a17f3d0530 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2014, International Business Machines Corporation and
+ * Copyright (c) 1997-2015, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************
  *
@@ -46,6 +46,7 @@
 #include "ustrfmt.h"
 #include "util.h"
 #include "uvector.h"
+#include "visibledigits.h"
 
 // *****************************************************************************
 // class MessageFormat
@@ -1955,8 +1956,12 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
     context.formatter->format(context.number, context.numberString, ec);
     const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
     if(decFmt != NULL) {
-        FixedDecimal dec = decFmt->getFixedDecimal(context.number, ec);
-        return rules->select(dec);
+        VisibleDigitsWithExponent digits;
+        decFmt->initVisibleDigitsWithExponent(context.number, digits, ec);
+        if (U_FAILURE(ec)) {
+            return UnicodeString(FALSE, OTHER_STRING, 5);
+        }
+        return rules->select(digits);
     } else {
         return rules->select(number);
     }