summaryrefslogtreecommitdiff
path: root/framework/I18N/core
diff options
context:
space:
mode:
authorCiro Mattia Gonano <ciromattia@gmail.com>2013-04-24 09:59:46 +0200
committerCiro Mattia Gonano <ciromattia@gmail.com>2013-04-24 09:59:48 +0200
commitdaa4dde508865ef0f08e584987b0695d4847809a (patch)
treee4aaed56bea63ec5d569fc74ff10f0e36618c50e /framework/I18N/core
parenta08d87f68a22df1ffb001ebe1cc3f438c045b843 (diff)
Update to 3.2.1
Diffstat (limited to 'framework/I18N/core')
-rw-r--r--framework/I18N/core/CultureInfo.php4
-rw-r--r--framework/I18N/core/Gettext/MO.php2
-rw-r--r--framework/I18N/core/Gettext/PO.php2
-rw-r--r--framework/I18N/core/Gettext/TGettext.php2
-rw-r--r--framework/I18N/core/MessageCache.php4
-rw-r--r--framework/I18N/core/NumberFormat.php66
-rw-r--r--framework/I18N/core/TCache_Lite.php2
-rw-r--r--framework/I18N/core/data/fr_CA.dat2
-rw-r--r--framework/I18N/core/data/it_IT.dat2
9 files changed, 32 insertions, 54 deletions
diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php
index 799ccdb4..c22ed5c4 100644
--- a/framework/I18N/core/CultureInfo.php
+++ b/framework/I18N/core/CultureInfo.php
@@ -13,7 +13,7 @@
* {@link http://prado.sourceforge.net/}
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @version $Id$
+ * @version $Id: CultureInfo.php 3187 2012-07-12 11:21:01Z ctrlaltca $
* @package System.I18N.core
*/
@@ -44,7 +44,7 @@
* For example, Australian English is "en_AU".
*
* @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @version $Id$
+ * @version $Id: CultureInfo.php 3187 2012-07-12 11:21:01Z ctrlaltca $
* @package System.I18N.core
*/
class CultureInfo
diff --git a/framework/I18N/core/Gettext/MO.php b/framework/I18N/core/Gettext/MO.php
index 4b34034e..3e84ef2e 100644
--- a/framework/I18N/core/Gettext/MO.php
+++ b/framework/I18N/core/Gettext/MO.php
@@ -29,7 +29,7 @@
// | Copyright (c) 2004 Michael Wallner <mike@iworks.at> |
// +----------------------------------------------------------------------+
//
-// $Id$
+// $Id: MO.php 3187 2012-07-12 11:21:01Z ctrlaltca $
/**
* File::Gettext::MO
diff --git a/framework/I18N/core/Gettext/PO.php b/framework/I18N/core/Gettext/PO.php
index 57028f6d..950a5de3 100644
--- a/framework/I18N/core/Gettext/PO.php
+++ b/framework/I18N/core/Gettext/PO.php
@@ -28,7 +28,7 @@
// | Copyright (c) 2004 Michael Wallner <mike@iworks.at> |
// +----------------------------------------------------------------------+
//
-// $Id$
+// $Id: PO.php 3187 2012-07-12 11:21:01Z ctrlaltca $
/**
* File::Gettext::PO
diff --git a/framework/I18N/core/Gettext/TGettext.php b/framework/I18N/core/Gettext/TGettext.php
index 4ca7fadb..abf32392 100644
--- a/framework/I18N/core/Gettext/TGettext.php
+++ b/framework/I18N/core/Gettext/TGettext.php
@@ -28,7 +28,7 @@
// | Copyright (c) 2004 Michael Wallner <mike@iworks.at> |
// +----------------------------------------------------------------------+
//
-// $Id$
+// $Id: TGettext.php 3187 2012-07-12 11:21:01Z ctrlaltca $
/**
* File::Gettext
diff --git a/framework/I18N/core/MessageCache.php b/framework/I18N/core/MessageCache.php
index e721a332..3bd21704 100644
--- a/framework/I18N/core/MessageCache.php
+++ b/framework/I18N/core/MessageCache.php
@@ -2,7 +2,7 @@
/**
* Translation table cache.
* @author $Author: weizhuo $
- * @version $Id$
+ * @version $Id: MessageCache.php 3188 2012-07-12 12:13:23Z ctrlaltca $
* @package System.I18N.core
*/
@@ -16,7 +16,7 @@ require_once(dirname(__FILE__).'/TCache_Lite.php');
* It can cache each cataloug+variant or just the whole section.
* @package System.I18N.core
* @author $Author: weizhuo $
- * @version $Id$
+ * @version $Id: MessageCache.php 3188 2012-07-12 12:13:23Z ctrlaltca $
*/
class MessageCache
{
diff --git a/framework/I18N/core/NumberFormat.php b/framework/I18N/core/NumberFormat.php
index 3c733713..25af6846 100644
--- a/framework/I18N/core/NumberFormat.php
+++ b/framework/I18N/core/NumberFormat.php
@@ -118,11 +118,9 @@ class NumberFormat
$this->setPattern($pattern);
if(strtolower($pattern) == 'p')
- $number = $number * 100;
+ $number = $number * 100.0;
- $string = (string)$number;
-
- $decimal = $this->formatDecimal($string);
+ $decimal = $this->formatDecimal($number);
$integer = $this->formatInteger(abs($number));
if(strlen($decimal)>0)
@@ -157,17 +155,17 @@ class NumberFormat
* @param string the decimal number in string form.
* @return string formatted integer string with grouping
*/
- protected function formatInteger($string)
+ protected function formatInteger($number)
{
- $string = (string)$string;
-
$decimalDigits = $this->formatInfo->DecimalDigits;
+ $string = (string)intval(round($number,$decimalDigits));
+
//if not decimal digits, assume 0 decimal points.
- if(is_int($decimalDigits) && $decimalDigits > 0)
- $string = (string)round(floatval($string),$decimalDigits);
- $dp = strpos($string, '.');
- if(is_int($dp))
- $string = substr($string, 0, $dp);
+ //if(is_int($decimalDigits) && $decimalDigits > 0)
+ // $string = (string)round(floatval($string),$decimalDigits);
+ //$dp = strpos($string, '.');
+ //if(is_int($dp))
+ // $string = substr($string, 0, $dp);
$integer = '';
$digitSize = $this->formatInfo->getDigitSize();
@@ -230,43 +228,23 @@ class NumberFormat
* @param string the decimal number in string form.
* @return string formatted decimal places.
*/
- protected function formatDecimal($string)
+ protected function formatDecimal($number)
{
- $dp = strpos($string, '.');
- $decimal = '';
-
$decimalDigits = $this->formatInfo->DecimalDigits;
$decimalSeparator = $this->formatInfo->DecimalSeparator;
+ $decimal = '';
- //do the correct rounding here
- //$string = round(floatval($string), $decimalDigits);
- if(is_int($dp))
- {
- if($decimalDigits == -1)
- {
- $decimal = substr($string, $dp+1);
- }
- else if(is_int($decimalDigits))
- {
- $float = round((float)$string, $decimalDigits);
- if(strpos((string)$float, '.') === false)
- {
- $decimal = str_pad($decimal,$decimalDigits,'0');
- }
- else
- {
- $decimal = substr($float, strpos($float,'.')+1);
- if(strlen($decimal)<$decimalDigits)
- $decimal = str_pad($decimal,$decimalDigits,'0');
- }
- }
- else
- return $decimal;
+ if ($decimalDigits > 0) {
+ //do the correct rounding here
+ $number = round(floatval($number), $decimalDigits);
+ $decimal = substr((string)$number,strlen((string)intval($number))+1 );
+ $decimal = $decimalSeparator.str_pad($decimal,$decimalDigits,'0',STR_PAD_RIGHT);
+
+ } elseif($decimalDigits == -1) {
+ $decimal = $decimalSeparator.substr((string)$number,strlen((string)intval($number))+1 );
+ } elseif($decimalDigits == false)
+ $decimal = $decimalSeparator.substr((string)$number,strlen((string)intval($number))+1 );
- return $decimalSeparator.$decimal;
- }
- else if ($decimalDigits > 0)
- return $decimalSeparator.str_pad($decimal,$decimalDigits,'0');
return $decimal;
}
diff --git a/framework/I18N/core/TCache_Lite.php b/framework/I18N/core/TCache_Lite.php
index bd4964ad..a0629bd1 100644
--- a/framework/I18N/core/TCache_Lite.php
+++ b/framework/I18N/core/TCache_Lite.php
@@ -38,7 +38,7 @@
* Mike BENOIT <ipso@snappymail.ca>
*
* @package System.I18N.core
-* @version $Id$
+* @version $Id: TCache_Lite.php 3188 2012-07-12 12:13:23Z ctrlaltca $
* @author Fabien MARTY <fab@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
diff --git a/framework/I18N/core/data/fr_CA.dat b/framework/I18N/core/data/fr_CA.dat
index 855fe7a6..fb152bf0 100644
--- a/framework/I18N/core/data/fr_CA.dat
+++ b/framework/I18N/core/data/fr_CA.dat
@@ -1 +1 @@
-a:4:{s:10:"Currencies";a:2:{s:3:"CAD";a:2:{i:0;s:1:"$";i:1;s:15:"dollar canadien";}s:3:"USD";a:2:{i:0;s:4:"$ US";i:1;s:22:"dollar des États-Unis";}}s:14:"NumberPatterns";a:4:{i:0;s:20:"#,##0.###;-#,##0.###";i:1;s:24:"#,##0.00 ¤;(#,##0.00¤)";i:2;s:6:"#,##0%";i:3;s:3:"#E0";}s:7:"Version";a:1:{i:0;s:3:"1.2";}s:8:"calendar";a:1:{s:9:"gregorian";a:3:{s:26:"DateTimeElements:intvector";a:2:{i:0;i:1;i:1;i:4;}s:16:"DateTimePatterns";a:9:{i:0;s:24:"HH' h 'mm' min 'ss' s 'z";i:1;s:10:"HH:mm:ss z";i:2;s:8:"HH:mm:ss";i:3;s:5:"HH:mm";i:4;s:16:"EEEE d MMMM yyyy";i:5;s:11:"d MMMM yyyy";i:6;s:10:"yyyy-MM-dd";i:7;s:8:"yy-MM-dd";i:8;s:7:"{1} {0}";}s:17:"weekend:intvector";a:4:{i:0;i:7;i:1;i:0;i:2;i:1;i:3;i:86400000;}}}} \ No newline at end of file
+a:4:{s:10:"Currencies";a:2:{s:3:"CAD";a:2:{i:0;s:1:"$";i:1;s:15:"dollar canadien";}s:3:"USD";a:2:{i:0;s:4:"$ US";i:1;s:22:"dollar des États-Unis";}}s:14:"NumberPatterns";a:4:{i:0;s:20:"#,##0.###;-#,##0.###";i:1;s:24:"#,##0.00 ¤;(#,##0.00¤)";i:2;s:6:"#,##0%";i:3;s:3:"#E0";}s:7:"Version";a:1:{i:0;s:3:"1.2";}s:8:"calendar";a:1:{s:9:"gregorian";a:3:{s:26:"DateTimeElements:intvector";a:2:{i:0;i:1;i:1;i:4;}s:16:"DateTimePatterns";a:9:{i:0;s:24:"HH' h 'mm' min 'ss' s 'z";i:1;s:10:"HH:mm:ss z";i:2;s:8:"HH:mm:ss";i:3;s:5:"HH:mm";i:4;s:16:"EEEE d MMMM yyyy";i:5;s:11:"d MMMM yyyy";i:6;s:8:"yy-MM-dd";i:7;s:8:"yy-MM-dd";i:8;s:7:"{1} {0}";}s:17:"weekend:intvector";a:4:{i:0;i:7;i:1;i:0;i:2;i:1;i:3;i:86400000;}}}} \ No newline at end of file
diff --git a/framework/I18N/core/data/it_IT.dat b/framework/I18N/core/data/it_IT.dat
index 2545451b..738a8455 100644
--- a/framework/I18N/core/data/it_IT.dat
+++ b/framework/I18N/core/data/it_IT.dat
@@ -1 +1 @@
-a:3:{s:10:"Currencies";a:1:{s:3:"ITL";a:3:{i:0;s:3:"₤";i:1;s:13:"Lira Italiana";i:2;a:3:{i:0;s:18:"¤ #,##0;-¤ #,##0";i:1;s:1:",";i:2;s:1:".";}}}s:7:"Version";a:1:{i:0;s:3:"1.2";}s:8:"calendar";a:1:{s:9:"gregorian";a:1:{s:16:"DateTimePatterns";a:9:{i:0;s:10:"HH:mm:ss z";i:1;s:9:"H:mm:ss z";i:2;s:8:"HH:mm:ss";i:3;s:5:"HH:mm";i:4;s:16:"EEEE d MMMM yyyy";i:5;s:12:"dd MMMM yyyy";i:6;s:9:"dd/MMM/yy";i:7;s:8:"dd/MM/yy";i:8;s:7:"{1} {0}";}}}} \ No newline at end of file
+a:3:{s:10:"Currencies";a:1:{s:3:"ITL";a:3:{i:0;s:3:"₤";i:1;s:13:"Lira Italiana";i:2;a:3:{i:0;s:18:"¤ #,##0;-¤ #,##0";i:1;s:1:",";i:2;s:1:".";}}}s:7:"Version";a:1:{i:0;s:3:"1.2";}s:8:"calendar";a:1:{s:9:"gregorian";a:1:{s:16:"DateTimePatterns";a:9:{i:0;s:10:"HH:mm:ss z";i:1;s:9:"H:mm:ss z";i:2;s:8:"HH:mm:ss";i:3;s:5:"HH:mm";i:4;s:16:"EEEE d MMMM yyyy";i:5;s:12:"dd MMMM yyyy";i:6;s:9:"dd/MMM/yy";i:7;s:10:"dd/MM/yyyy";i:8;s:7:"{1} {0}";}}}} \ No newline at end of file