Skip to content

Commit

Permalink
[ZF-10123] Zend_Locale
Browse files Browse the repository at this point in the history
- finished CLDR 1.9 integration
- new features will be integrated with Locale 2.0
  • Loading branch information
thomasweidner committed Jan 2, 2011
1 parent 85a17db commit 0fe86d2
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 1,734 deletions.
36 changes: 18 additions & 18 deletions library/Zend/Currency/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
namespace Zend\Currency;
use Zend\Cache\Frontend;
use Zend\Locale;
use Zend\Locale\Data;
use Zend\Locale\Data\Cldr;

/**
* Class for handling currency notations
*
* @uses Zend\Cache\Frontend;
* @uses Zend\Locale
* @uses Zend\Locale\Format
* @uses Zend\Locale\Data
* @uses Zend\Locale\Data\Cldr
* @category Zend
* @package Zend_Currency
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
Expand Down Expand Up @@ -175,10 +175,10 @@ public function toCurrency($value = null, array $options = array())
$format = $options['format'];
$locale = $options['locale'];
if (empty($format)) {
$format = Data::getContent($locale, 'currencynumber');
$format = Cldr::getContent($locale, 'currencynumber');
} else if (Locale\Locale::isLocale($format, true)) {
$locale = $format;
$format = Data::getContent($format, 'currencynumber');
$format = Cldr::getContent($format, 'currencynumber');
}

$original = $value;
Expand Down Expand Up @@ -312,7 +312,7 @@ private function _checkParams($currency = null, $locale = null)
}

// Get the available currencies for this country
$data = Data::getContent($locale, 'currencytoregion', $country);
$data = Cldr::getContent($locale, 'currencytoregion', $country);
if ((empty($currency) === false) and (empty($data) === false)) {
$abbreviation = $currency;
} else {
Expand All @@ -339,9 +339,9 @@ public function getSymbol($currency = null, $locale = null)
$params = self::_checkParams($currency, $locale);

// Get the symbol
$symbol = Data::getContent($params['locale'], 'currencysymbol', $params['currency']);
$symbol = Cldr::getContent($params['locale'], 'currencysymbol', $params['currency']);
if (empty($symbol) === true) {
$symbol = Data::getContent($params['locale'], 'currencysymbol', $params['name']);
$symbol = Cldr::getContent($params['locale'], 'currencysymbol', $params['name']);
}

if (empty($symbol) === true) {
Expand Down Expand Up @@ -371,9 +371,9 @@ public function getShortName($currency = null, $locale = null)
return $params['name'];
}

$list = Data::getContent($params['locale'], 'currencytoname', $params['currency']);
$list = Cldr::getContent($params['locale'], 'currencytoname', $params['currency']);
if (empty($list) === true) {
$list = Data::getContent($params['locale'], 'nametocurrency', $params['currency']);
$list = Cldr::getContent($params['locale'], 'nametocurrency', $params['currency']);
if (empty($list) === false) {
$list = $params['currency'];
}
Expand Down Expand Up @@ -402,9 +402,9 @@ public function getName($currency = null, $locale = null)
$params = self::_checkParams($currency, $locale);

// Get the name
$name = Data::getContent($params['locale'], 'nametocurrency', $params['currency']);
$name = Cldr::getContent($params['locale'], 'nametocurrency', $params['currency']);
if (empty($name) === true) {
$name = Data::getContent($params['locale'], 'nametocurrency', $params['name']);
$name = Cldr::getContent($params['locale'], 'nametocurrency', $params['name']);
}

if (empty($name) === true) {
Expand All @@ -431,7 +431,7 @@ public function getRegionList($currency = null)
throw new Exception\InvalidArgumentException('No currency defined');
}

$data = Data::getContent('', 'regiontocurrency', $currency);
$data = Cldr::getContent('', 'regiontocurrency', $currency);

$result = explode(' ', $data);
return $result;
Expand All @@ -453,7 +453,7 @@ public function getCurrencyList($region = null)
}
}

return Data::getList('', 'regiontocurrency', $region);
return Cldr::getList('', 'regiontocurrency', $region);
}

/**
Expand Down Expand Up @@ -483,7 +483,7 @@ public function __toString()
*/
public static function getCache()
{
return Data::getCache();
return Cldr::getCache();
}

/**
Expand All @@ -494,7 +494,7 @@ public static function getCache()
*/
public static function setCache(Frontend $cache)
{
Data::setCache($cache);
Cldr::setCache($cache);
}

/**
Expand All @@ -504,7 +504,7 @@ public static function setCache(Frontend $cache)
*/
public static function hasCache()
{
return Data::hasCache();
return Cldr::hasCache();
}

/**
Expand All @@ -514,7 +514,7 @@ public static function hasCache()
*/
public static function removeCache()
{
Data::removeCache();
Cldr::removeCache();
}

/**
Expand All @@ -524,7 +524,7 @@ public static function removeCache()
*/
public static function clearCache()
{
Data::clearCache();
Cldr::clearCache();
}

/**
Expand Down

0 comments on commit 0fe86d2

Please sign in to comment.