From 550ba06593b467b643862d41a00ca2dd12ee704b Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 2 Aug 2006 02:24:29 +0000 Subject: merge from 3.0 branch till 1320. --- framework/I18N/core/MessageFormat.php | 4 ++++ framework/I18N/core/NumberFormat.php | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'framework/I18N') diff --git a/framework/I18N/core/MessageFormat.php b/framework/I18N/core/MessageFormat.php index dab7434c..3faa663d 100644 --- a/framework/I18N/core/MessageFormat.php +++ b/framework/I18N/core/MessageFormat.php @@ -161,6 +161,10 @@ class MessageFormat public function format($string,$args=array(), $catalogue=null, $charset=null) { if(empty($charset)) $charset = $this->getCharset(); + + //force args as UTF-8 + foreach($args as $k => $v) + $args[$k] = I18N_toUTF8($v, $charset); $s = $this->formatString(I18N_toUTF8($string, $charset),$args,$catalogue); return I18N_toEncoding($s, $charset); } diff --git a/framework/I18N/core/NumberFormat.php b/framework/I18N/core/NumberFormat.php index 8e715f15..b30e615b 100644 --- a/framework/I18N/core/NumberFormat.php +++ b/framework/I18N/core/NumberFormat.php @@ -161,9 +161,14 @@ class NumberFormat $string = (string)$string; $dp = strpos($string, '.'); + $decimalDigits = $this->formatInfo->DecimalDigits; +// var_dump($decimalDigits); + //if not decimal digits, assume 0 decimal points. + if(is_int($decimalDigits) && $decimalDigits > 0) + $string = (string)round(floatval($string),$decimalDigits); if(is_int($dp)) - $string = substr($string, 0, $dp); - + $string = substr($string, 0, $dp); + $integer = ''; $digitSize = $this->formatInfo->getDigitSize(); @@ -233,7 +238,9 @@ class NumberFormat $decimalDigits = $this->formatInfo->DecimalDigits; $decimalSeparator = $this->formatInfo->DecimalSeparator; - + + //do the correct rounding here + //$string = round(floatval($string), $decimalDigits); if(is_int($dp)) { if($decimalDigits == -1) -- cgit v1.2.3