diff --git a/library/Zend/Currency/Currency.php b/library/Zend/Currency/Currency.php
index 14b47bd53a5..e69b472b65d 100644
--- a/library/Zend/Currency/Currency.php
+++ b/library/Zend/Currency/Currency.php
@@ -24,7 +24,7 @@
namespace Zend\Currency;
use Zend\Cache\Frontend;
use Zend\Locale;
-use Zend\Locale\Data;
+use Zend\Locale\Data\Cldr;
/**
* Class for handling currency notations
@@ -32,7 +32,7 @@
* @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)
@@ -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;
@@ -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 {
@@ -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) {
@@ -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'];
}
@@ -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) {
@@ -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;
@@ -453,7 +453,7 @@ public function getCurrencyList($region = null)
}
}
- return Data::getList('', 'regiontocurrency', $region);
+ return Cldr::getList('', 'regiontocurrency', $region);
}
/**
@@ -483,7 +483,7 @@ public function __toString()
*/
public static function getCache()
{
- return Data::getCache();
+ return Cldr::getCache();
}
/**
@@ -494,7 +494,7 @@ public static function getCache()
*/
public static function setCache(Frontend $cache)
{
- Data::setCache($cache);
+ Cldr::setCache($cache);
}
/**
@@ -504,7 +504,7 @@ public static function setCache(Frontend $cache)
*/
public static function hasCache()
{
- return Data::hasCache();
+ return Cldr::hasCache();
}
/**
@@ -514,7 +514,7 @@ public static function hasCache()
*/
public static function removeCache()
{
- Data::removeCache();
+ Cldr::removeCache();
}
/**
@@ -524,7 +524,7 @@ public static function removeCache()
*/
public static function clearCache()
{
- Data::clearCache();
+ Cldr::clearCache();
}
/**
diff --git a/library/Zend/Date/Date.php b/library/Zend/Date/Date.php
index 6b52058c73f..cac0e3dea30 100644
--- a/library/Zend/Date/Date.php
+++ b/library/Zend/Date/Date.php
@@ -25,7 +25,7 @@
use Zend\TimeSync;
use Zend\Locale\Locale;
use Zend\Locale\Format;
-use Zend\Locale\Data;
+use Zend\Locale\Data\Cldr;
use Zend\Locale\Math;
/**
@@ -276,7 +276,7 @@ public static function setOptions(array $options = array())
}
parent::$_cache = $value;
- Data::setCache($value);
+ Cldr::setCache($value);
}
break;
case 'timesync' :
@@ -601,7 +601,7 @@ private function _parseIsoToDate($token, $locale) {
case self::WEEKDAY_SHORT :
$weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false));
- $day = Data::getContent($locale, 'day', array('gregorian', 'format', 'wide', $weekday));
+ $day = Cldr::getContent($locale, 'day', array('gregorian', 'format', 'wide', $weekday));
return $this->_toComment(iconv_substr($day, 0, 3, 'UTF-8'));
break;
@@ -611,7 +611,7 @@ private function _parseIsoToDate($token, $locale) {
case self::WEEKDAY :
$weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false));
- return $this->_toComment(Data::getContent($locale, 'day', array('gregorian', 'format', 'wide', $weekday)));
+ return $this->_toComment(Cldr::getContent($locale, 'day', array('gregorian', 'format', 'wide', $weekday)));
break;
case self::WEEKDAY_8601 :
@@ -645,13 +645,13 @@ private function _parseIsoToDate($token, $locale) {
case self::WEEKDAY_NARROW :
case 'EEEEE' :
$weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false));
- $day = Data::getContent($locale, 'day', array('gregorian', 'format', 'abbreviated', $weekday));
+ $day = Cldr::getContent($locale, 'day', array('gregorian', 'format', 'abbreviated', $weekday));
return $this->_toComment(iconv_substr($day, 0, 1, 'UTF-8'));
break;
case self::WEEKDAY_NAME :
$weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false));
- return $this->_toComment(Data::getContent($locale, 'day', array('gregorian', 'format', 'abbreviated', $weekday)));
+ return $this->_toComment(Cldr::getContent($locale, 'day', array('gregorian', 'format', 'abbreviated', $weekday)));
break;
case 'w' :
@@ -665,7 +665,7 @@ private function _parseIsoToDate($token, $locale) {
case self::MONTH_NAME :
$month = $this->date('n', $this->getUnixTimestamp(), false);
- return $this->_toComment(Data::getContent($locale, 'month', array('gregorian', 'format', 'wide', $month)));
+ return $this->_toComment(Cldr::getContent($locale, 'month', array('gregorian', 'format', 'wide', $month)));
break;
case self::MONTH :
@@ -674,7 +674,7 @@ private function _parseIsoToDate($token, $locale) {
case self::MONTH_NAME_SHORT :
$month = $this->date('n', $this->getUnixTimestamp(), false);
- return $this->_toComment(Data::getContent($locale, 'month', array('gregorian', 'format', 'abbreviated', $month)));
+ return $this->_toComment(Cldr::getContent($locale, 'month', array('gregorian', 'format', 'abbreviated', $month)));
break;
case self::MONTH_SHORT :
@@ -687,7 +687,7 @@ private function _parseIsoToDate($token, $locale) {
case self::MONTH_NAME_NARROW :
$month = $this->date('n', $this->getUnixTimestamp(), false);
- $mon = Data::getContent($locale, 'month', array('gregorian', 'format', 'abbreviated', $month));
+ $mon = Cldr::getContent($locale, 'month', array('gregorian', 'format', 'abbreviated', $month));
return $this->_toComment(iconv_substr($mon, 0, 1, 'UTF-8'));
break;
@@ -714,10 +714,10 @@ private function _parseIsoToDate($token, $locale) {
case self::MERIDIEM :
$am = $this->date('a', $this->getUnixTimestamp(), false);
if ($am == 'am') {
- return $this->_toComment(Data::getContent($locale, 'am'));
+ return $this->_toComment(Cldr::getContent($locale, 'am'));
}
- return $this->_toComment(Data::getContent($locale, 'pm'));
+ return $this->_toComment(Cldr::getContent($locale, 'pm'));
break;
case self::SWATCH :
@@ -807,28 +807,28 @@ private function _parseIsoToDate($token, $locale) {
case 'GGG' :
$year = $this->date('Y', $this->getUnixTimestamp(), false);
if ($year < 0) {
- return $this->_toComment(Data::getContent($locale, 'era', array('gregorian', 'Abbr', '0')));
+ return $this->_toComment(Cldr::getContent($locale, 'era', array('gregorian', 'Abbr', '0')));
}
- return $this->_toComment(Data::getContent($locale, 'era', array('gregorian', 'Abbr', '1')));
+ return $this->_toComment(Cldr::getContent($locale, 'era', array('gregorian', 'Abbr', '1')));
break;
case self::ERA_NARROW :
$year = $this->date('Y', $this->getUnixTimestamp(), false);
if ($year < 0) {
- return $this->_toComment(iconv_substr(Data::getContent($locale, 'era', array('gregorian', 'Abbr', '0')), 0, 1, 'UTF-8')) . '.';
+ return $this->_toComment(iconv_substr(Cldr::getContent($locale, 'era', array('gregorian', 'Abbr', '0')), 0, 1, 'UTF-8')) . '.';
}
- return $this->_toComment(iconv_substr(Data::getContent($locale, 'era', array('gregorian', 'Abbr', '1')), 0, 1, 'UTF-8')) . '.';
+ return $this->_toComment(iconv_substr(Cldr::getContent($locale, 'era', array('gregorian', 'Abbr', '1')), 0, 1, 'UTF-8')) . '.';
break;
case self::ERA_NAME :
$year = $this->date('Y', $this->getUnixTimestamp(), false);
if ($year < 0) {
- return $this->_toComment(Data::getContent($locale, 'era', array('gregorian', 'Names', '0')));
+ return $this->_toComment(Cldr::getContent($locale, 'era', array('gregorian', 'Names', '0')));
}
- return $this->_toComment(Data::getContent($locale, 'era', array('gregorian', 'Names', '1')));
+ return $this->_toComment(Cldr::getContent($locale, 'era', array('gregorian', 'Names', '1')));
break;
case self::DATES :
@@ -836,19 +836,19 @@ private function _parseIsoToDate($token, $locale) {
break;
case self::DATE_FULL :
- return $this->_toToken(Data::getContent($locale, 'date', array('gregorian', 'full')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'date', array('gregorian', 'full')), $locale);
break;
case self::DATE_LONG :
- return $this->_toToken(Data::getContent($locale, 'date', array('gregorian', 'long')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'date', array('gregorian', 'long')), $locale);
break;
case self::DATE_MEDIUM :
- return $this->_toToken(Data::getContent($locale, 'date', array('gregorian', 'medium')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'date', array('gregorian', 'medium')), $locale);
break;
case self::DATE_SHORT :
- return $this->_toToken(Data::getContent($locale, 'date', array('gregorian', 'short')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'date', array('gregorian', 'short')), $locale);
break;
case self::TIMES :
@@ -856,19 +856,19 @@ private function _parseIsoToDate($token, $locale) {
break;
case self::TIME_FULL :
- return $this->_toToken(Data::getContent($locale, 'time', 'full'), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'time', 'full'), $locale);
break;
case self::TIME_LONG :
- return $this->_toToken(Data::getContent($locale, 'time', 'long'), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'time', 'long'), $locale);
break;
case self::TIME_MEDIUM :
- return $this->_toToken(Data::getContent($locale, 'time', 'medium'), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'time', 'medium'), $locale);
break;
case self::TIME_SHORT :
- return $this->_toToken(Data::getContent($locale, 'time', 'short'), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'time', 'short'), $locale);
break;
case self::DATETIME :
@@ -876,19 +876,19 @@ private function _parseIsoToDate($token, $locale) {
break;
case self::DATETIME_FULL :
- return $this->_toToken(Data::getContent($locale, 'datetime', array('gregorian', 'full')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'datetime', array('gregorian', 'full')), $locale);
break;
case self::DATETIME_LONG :
- return $this->_toToken(Data::getContent($locale, 'datetime', array('gregorian', 'long')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'datetime', array('gregorian', 'long')), $locale);
break;
case self::DATETIME_MEDIUM :
- return $this->_toToken(Data::getContent($locale, 'datetime', array('gregorian', 'medium')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'datetime', array('gregorian', 'medium')), $locale);
break;
case self::DATETIME_SHORT :
- return $this->_toToken(Data::getContent($locale, 'datetime', array('gregorian', 'short')), $locale);
+ return $this->_toToken(Cldr::getContent($locale, 'datetime', array('gregorian', 'short')), $locale);
break;
case self::ATOM :
@@ -1452,7 +1452,7 @@ private function _calculate($calc, $date, $part, $locale)
break;
case self::WEEKDAY_SHORT:
- $daylist = Data::getList($locale, 'day');
+ $daylist = Cldr::getList($locale, 'day');
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
$cnt = 0;
@@ -1484,7 +1484,7 @@ private function _calculate($calc, $date, $part, $locale)
break;
case self::WEEKDAY:
- $daylist = Data::getList($locale, 'day');
+ $daylist = Cldr::getList($locale, 'day');
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
$cnt = 0;
@@ -1548,7 +1548,7 @@ private function _calculate($calc, $date, $part, $locale)
break;
case self::WEEKDAY_NARROW:
- $daylist = Data::getList($locale, 'day', array('gregorian', 'format', 'abbreviated'));
+ $daylist = Cldr::getList($locale, 'day', array('gregorian', 'format', 'abbreviated'));
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
$cnt = 0;
foreach ($daylist as $key => $value) {
@@ -1570,7 +1570,7 @@ private function _calculate($calc, $date, $part, $locale)
break;
case self::WEEKDAY_NAME:
- $daylist = Data::getList($locale, 'day', array('gregorian', 'format', 'abbreviated'));
+ $daylist = Cldr::getList($locale, 'day', array('gregorian', 'format', 'abbreviated'));
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
$cnt = 0;
foreach ($daylist as $key => $value) {
@@ -1604,7 +1604,7 @@ private function _calculate($calc, $date, $part, $locale)
// month formats
case self::MONTH_NAME:
- $monthlist = Data::getList($locale, 'month');
+ $monthlist = Cldr::getList($locale, 'month');
$cnt = 0;
foreach ($monthlist as $key => $value) {
if (strtoupper($value) == strtoupper($date)) {
@@ -1675,7 +1675,7 @@ private function _calculate($calc, $date, $part, $locale)
break;
case self::MONTH_NAME_SHORT:
- $monthlist = Data::getList($locale, 'month', array('gregorian', 'format', 'abbreviated'));
+ $monthlist = Cldr::getList($locale, 'month', array('gregorian', 'format', 'abbreviated'));
$cnt = 0;
foreach ($monthlist as $key => $value) {
if (strtoupper($value) == strtoupper($date)) {
@@ -1751,7 +1751,7 @@ private function _calculate($calc, $date, $part, $locale)
break;
case self::MONTH_NAME_NARROW:
- $monthlist = Data::getList($locale, 'month', array('gregorian', 'stand-alone', 'narrow'));
+ $monthlist = Cldr::getList($locale, 'month', array('gregorian', 'stand-alone', 'narrow'));
$cnt = 0;
foreach ($monthlist as $key => $value) {
if (strtoupper($value) === strtoupper($date)) {
@@ -2123,7 +2123,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATE_FULL:
try {
- $format = Data::getContent($locale, 'date', array('gregorian', 'full'));
+ $format = Cldr::getContent($locale, 'date', array('gregorian', 'full'));
$parsed = Format::getDate($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if (($calc == 'set') || ($calc == 'cmp')) {
@@ -2143,7 +2143,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATE_LONG:
try {
- $format = Data::getContent($locale, 'date', array('gregorian', 'long'));
+ $format = Cldr::getContent($locale, 'date', array('gregorian', 'long'));
$parsed = Format::getDate($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if (($calc == 'set') || ($calc == 'cmp')){
@@ -2163,7 +2163,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATE_MEDIUM:
try {
- $format = Data::getContent($locale, 'date', array('gregorian', 'medium'));
+ $format = Cldr::getContent($locale, 'date', array('gregorian', 'medium'));
$parsed = Format::getDate($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if (($calc == 'set') || ($calc == 'cmp')) {
@@ -2183,7 +2183,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATE_SHORT:
try {
- $format = Data::getContent($locale, 'date', array('gregorian', 'short'));
+ $format = Cldr::getContent($locale, 'date', array('gregorian', 'short'));
$parsed = Format::getDate($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
$parsed['year'] = self::getFullYear($parsed['year']);
@@ -2220,7 +2220,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::TIME_FULL:
try {
- $format = Data::getContent($locale, 'time', array('gregorian', 'full'));
+ $format = Cldr::getContent($locale, 'time', array('gregorian', 'full'));
$parsed = Format::getTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if ($calc != 'set') {
$month = 1;
@@ -2241,7 +2241,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::TIME_LONG:
try {
- $format = Data::getContent($locale, 'time', array('gregorian', 'long'));
+ $format = Cldr::getContent($locale, 'time', array('gregorian', 'long'));
$parsed = Format::getTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if ($calc != 'set') {
$month = 1;
@@ -2257,7 +2257,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::TIME_MEDIUM:
try {
- $format = Data::getContent($locale, 'time', array('gregorian', 'medium'));
+ $format = Cldr::getContent($locale, 'time', array('gregorian', 'medium'));
$parsed = Format::getTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if ($calc != 'set') {
$month = 1;
@@ -2273,7 +2273,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::TIME_SHORT:
try {
- $format = Data::getContent($locale, 'time', array('gregorian', 'short'));
+ $format = Cldr::getContent($locale, 'time', array('gregorian', 'short'));
$parsed = Format::getTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if ($calc != 'set') {
$month = 1;
@@ -2312,7 +2312,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATETIME_FULL:
try {
- $format = Data::getContent($locale, 'datetime', array('gregorian', 'full'));
+ $format = Cldr::getContent($locale, 'datetime', array('gregorian', 'full'));
$parsed = Format::getDateTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if (($calc == 'set') || ($calc == 'cmp')) {
@@ -2337,7 +2337,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATETIME_LONG:
try {
- $format = Data::getContent($locale, 'datetime', array('gregorian', 'long'));
+ $format = Cldr::getContent($locale, 'datetime', array('gregorian', 'long'));
$parsed = Format::getDateTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if (($calc == 'set') || ($calc == 'cmp')){
@@ -2357,7 +2357,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATETIME_MEDIUM:
try {
- $format = Data::getContent($locale, 'datetime', array('gregorian', 'medium'));
+ $format = Cldr::getContent($locale, 'datetime', array('gregorian', 'medium'));
$parsed = Format::getDateTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
if (($calc == 'set') || ($calc == 'cmp')) {
--$parsed['month'];
@@ -2376,7 +2376,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::DATETIME_SHORT:
try {
- $format = Data::getContent($locale, 'datetime', array('gregorian', 'short'));
+ $format = Cldr::getContent($locale, 'datetime', array('gregorian', 'short'));
$parsed = Format::getDateTime($date, array('date_format' => $format, 'format_type' => 'iso', 'locale' => $locale));
$parsed['year'] = self::getFullYear($parsed['year']);
@@ -3592,8 +3592,8 @@ private function _month($calc, $month, $locale)
throw new Exception\InvalidArgumentException("no month given in array");
}
} else {
- $monthlist = Data::getList($locale, 'month');
- $monthlist2 = Data::getList($locale, 'month', array('gregorian', 'format', 'abbreviated'));
+ $monthlist = Cldr::getList($locale, 'month');
+ $monthlist2 = Cldr::getList($locale, 'month', array('gregorian', 'format', 'abbreviated'));
$monthlist = array_merge($monthlist, $monthlist2);
$found = 0;
@@ -4794,49 +4794,49 @@ protected static function _getLocalizedToken($token, $locale)
return "EEE, dd MMM yyyy HH:mm:ss";
break;
case self::DATES :
- return Data::getContent($locale, 'date');
+ return Cldr::getContent($locale, 'date');
break;
case self::DATE_FULL :
- return Data::getContent($locale, 'date', array('gregorian', 'full'));
+ return Cldr::getContent($locale, 'date', array('gregorian', 'full'));
break;
case self::DATE_LONG :
- return Data::getContent($locale, 'date', array('gregorian', 'long'));
+ return Cldr::getContent($locale, 'date', array('gregorian', 'long'));
break;
case self::DATE_MEDIUM :
- return Data::getContent($locale, 'date', array('gregorian', 'medium'));
+ return Cldr::getContent($locale, 'date', array('gregorian', 'medium'));
break;
case self::DATE_SHORT :
- return Data::getContent($locale, 'date', array('gregorian', 'short'));
+ return Cldr::getContent($locale, 'date', array('gregorian', 'short'));
break;
case self::TIMES :
- return Data::getContent($locale, 'time');
+ return Cldr::getContent($locale, 'time');
break;
case self::TIME_FULL :
- return Data::getContent($locale, 'time', array('gregorian', 'full'));
+ return Cldr::getContent($locale, 'time', array('gregorian', 'full'));
break;
case self::TIME_LONG :
- return Data::getContent($locale, 'time', array('gregorian', 'long'));
+ return Cldr::getContent($locale, 'time', array('gregorian', 'long'));
break;
case self::TIME_MEDIUM :
- return Data::getContent($locale, 'time', array('gregorian', 'medium'));
+ return Cldr::getContent($locale, 'time', array('gregorian', 'medium'));
break;
case self::TIME_SHORT :
- return Data::getContent($locale, 'time', array('gregorian', 'short'));
+ return Cldr::getContent($locale, 'time', array('gregorian', 'short'));
break;
case self::DATETIME :
- return Data::getContent($locale, 'datetime');
+ return Cldr::getContent($locale, 'datetime');
break;
case self::DATETIME_FULL :
- return Data::getContent($locale, 'datetime', array('gregorian', 'full'));
+ return Cldr::getContent($locale, 'datetime', array('gregorian', 'full'));
break;
case self::DATETIME_LONG :
- return Data::getContent($locale, 'datetime', array('gregorian', 'long'));
+ return Cldr::getContent($locale, 'datetime', array('gregorian', 'long'));
break;
case self::DATETIME_MEDIUM :
- return Data::getContent($locale, 'datetime', array('gregorian', 'medium'));
+ return Cldr::getContent($locale, 'datetime', array('gregorian', 'medium'));
break;
case self::DATETIME_SHORT :
- return Data::getContent($locale, 'datetime', array('gregorian', 'short'));
+ return Cldr::getContent($locale, 'datetime', array('gregorian', 'short'));
break;
case self::ATOM :
case self::RFC_3339 :
diff --git a/library/Zend/Locale/Data/AbstractLocale.php b/library/Zend/Locale/Data/AbstractLocale.php
index fb5989b6de9..7f0a4f7558b 100644
--- a/library/Zend/Locale/Data/AbstractLocale.php
+++ b/library/Zend/Locale/Data/AbstractLocale.php
@@ -25,7 +25,9 @@
namespace Zend\Locale\Data;
use Zend\Cache\Cache,
- Zend\Cache\Frontend as CacheFrontend;
+ Zend\Cache\Frontend as CacheFrontend,
+ Zend\Locale\Locale,
+ Zend\Locale\Exception\InvalidArgumentException;
/**
* Locale data reader, handles the CLDR
@@ -73,218 +75,21 @@ abstract class AbstractLocale
*/
protected static $_cacheDisabled = false;
- /**
- * Read the content from locale
- *
- * Can be called like:
- *
- * test
- * content
- * content2
- *
- *
- *
- * Case 1: _readFile('ar','/ldml/delimiter') -> returns [] = test
- * Case 1: _readFile('ar','/ldml/second[@type=myone]') -> returns [] = content
- * Case 2: _readFile('ar','/ldml/second','type') -> returns [myone] = content; [mysecond] = content2
- * Case 3: _readFile('ar','/ldml/delimiter',,'right') -> returns [right] = test
- * Case 4: _readFile('ar','/ldml/third','type','myone') -> returns [myone] = mythird
- *
- * @param string $locale
- * @param string $path
- * @param string $attribute
- * @param string $value
- * @access private
- * @return array
- */
- private static function _readFile($locale, $path, $attribute, $value, $temp)
- {
- // without attribute - read all values
- // with attribute - read only this value
- if (!empty(self::$_ldml[(string) $locale])) {
-
- $result = self::$_ldml[(string) $locale]->xpath($path);
- if (!empty($result)) {
- foreach ($result as &$found) {
-
- if (empty($value)) {
-
- if (empty($attribute)) {
- // Case 1
- $temp[] = (string) $found;
- } else if (empty($temp[(string) $found[$attribute]])){
- // Case 2
- $temp[(string) $found[$attribute]] = (string) $found;
- }
-
- } else if (empty ($temp[$value])) {
-
- if (empty($attribute)) {
- // Case 3
- $temp[$value] = (string) $found;
- } else {
- // Case 4
- $temp[$value] = (string) $found[$attribute];
- }
-
- }
- }
- }
- }
- return $temp;
- }
-
- /**
- * Find possible routing to other path or locale
- *
- * @param string $locale
- * @param string $path
- * @param string $attribute
- * @param string $value
- * @param array $temp
- * @access private
- */
- private static function _findRoute($locale, $path, $attribute, $value, &$temp)
- {
- // load locale file if not already in cache
- // needed for alias tag when referring to other locale
- if (empty(self::$_ldml[(string) $locale])) {
- $filename = __DIR__ . '/../../../resources/cldr/main/' . $locale . '.xml';
- if (!file_exists($filename)) {
- throw new Exception\InvalidArgumentException(
- "Missing locale file '$filename' for '$locale' locale."
- );
- }
-
- self::$_ldml[(string) $locale] = simplexml_load_file($filename);
- }
-
- // search for 'alias' tag in the search path for redirection
- $search = '';
- $tok = strtok($path, '/');
-
- // parse the complete path
- if (!empty(self::$_ldml[(string) $locale])) {
- while ($tok !== false) {
- $search .= '/' . $tok;
- if (strpos($search, '[@') !== false) {
- while (strrpos($search, '[@') > strrpos($search, ']')) {
- $tok = strtok('/');
- if (empty($tok)) {
- $search .= '/';
- }
- $search = $search . '/' . $tok;
- }
- }
- $result = self::$_ldml[(string) $locale]->xpath($search . '/alias');
-
- // alias found
- if (!empty($result)) {
-
- $source = $result[0]['source'];
- $newpath = $result[0]['path'];
-
- // new path - path //ldml is to ignore
- if ($newpath != '//ldml') {
- // other path - parse to make real path
-
- while (substr($newpath,0,3) == '../') {
- $newpath = substr($newpath, 3);
- $search = substr($search, 0, strrpos($search, '/'));
- }
-
- // truncate ../ to realpath otherwise problems with alias
- $path = $search . '/' . $newpath;
- while (($tok = strtok('/'))!== false) {
- $path = $path . '/' . $tok;
- }
- }
-
- // reroute to other locale
- if ($source != 'locale') {
- $locale = $source;
- }
-
- $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
- return false;
- }
-
- $tok = strtok('/');
- }
- }
- return true;
- }
-
- /**
- * Read the right LDML file
- *
- * @param string $locale
- * @param string $path
- * @param string $attribute
- * @param string $value
- * @access private
- */
- private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array())
- {
- $result = self::_findRoute($locale, $path, $attribute, $value, $temp);
- if ($result) {
- $temp = self::_readFile($locale, $path, $attribute, $value, $temp);
- }
-
- // parse required locales reversive
- // example: when given zh_Hans_CN
- // 1. -> zh_Hans_CN
- // 2. -> zh_Hans
- // 3. -> zh
- // 4. -> root
- if (($locale != 'root') && ($result)) {
- $locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
- if (!empty($locale)) {
- $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
- } else {
- $temp = self::_getFile('root', $path, $attribute, $value, $temp);
- }
- }
- return $temp;
- }
-
- /**
- * Find the details for supplemental calendar datas
- *
- * @param string $locale Locale for Detaildata
- * @param array $list List to search
- * @return string Key for Detaildata
- */
- private static function _calendarDetail($locale, $list)
- {
- $ret = "001";
- foreach ($list as $key => $value) {
- if (strpos($locale, '_') !== false) {
- $locale = substr($locale, strpos($locale, '_') + 1);
- }
- if (strpos($key, $locale) !== false) {
- $ret = $key;
- break;
- }
- }
- return $ret;
- }
-
/**
* Internal function for checking the locale
*
* @param string|\Zend\Locale $locale Locale to check
* @return string
*/
- private static function _checkLocale($locale)
+ protected static function _checkLocale($locale)
{
if (empty($locale)) {
$locale = new Locale();
}
if (!(Locale::isLocale((string) $locale))) {
- throw new Exception\InvalidArgumentException(
- "Locale (" . (string) $locale . ") is a unknown locale"
+ throw new InvalidArgumentException(
+ "Locale (" . (string) $locale . ") is no known locale"
);
}
diff --git a/library/Zend/Locale/Data/Cldr.php b/library/Zend/Locale/Data/Cldr.php
index 87084ce98fa..4892d6f9492 100644
--- a/library/Zend/Locale/Data/Cldr.php
+++ b/library/Zend/Locale/Data/Cldr.php
@@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Locale
- * @subpackage Cldr
+ * @subpackage Data
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -30,7 +30,7 @@
Zend\Locale\Exception\InvalidArgumentException;
/**
- * Locale data reader, handles the CLDR
+ * Locale data provider, handles CLDR
*
* @uses Zend\Cache\Cache
* @uses Zend\Locale
@@ -43,12 +43,12 @@
*/
class Cldr extends AbstractLocale
{
- /**
- * Internal path to CLDR resources
- */
- protected static $_path = '../../../../resources/cldr/';
+ /**
+ * Internal path to CLDR resources
+ */
+ protected static $_path = '../../../../resources/cldr/';
- /**
+ /**
* Locale files
*
* @var ressource
@@ -261,27 +261,6 @@ private static function _calendarDetail($locale, $list)
return $ret;
}
- /**
- * Internal function for checking the locale
- *
- * @param string|\Zend\Locale $locale Locale to check
- * @return string
- */
- private static function _checkLocale($locale)
- {
- if (empty($locale)) {
- $locale = new Locale();
- }
-
- if (!(Locale::isLocale((string) $locale))) {
- throw new InvalidArgumentException(
- "Locale (" . (string) $locale . ") is a unknown locale"
- );
- }
-
- return (string) $locale;
- }
-
/**
* Read the LDML file, get a array of multipath defined value
*
diff --git a/library/Zend/Locale/Data/Intl.php b/library/Zend/Locale/Data/Intl.php
index 248e6f2c437..f99262bd815 100644
--- a/library/Zend/Locale/Data/Intl.php
+++ b/library/Zend/Locale/Data/Intl.php
@@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Locale
- * @subpackage Cldr
+ * @subpackage Data
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -30,7 +30,7 @@
Zend\Locale\Exception;
/**
- * Locale data reader, handles the CLDR
+ * Locale data provider, handles INTL
*
* @uses Zend\Cache\Cache
* @uses Zend\Locale
@@ -41,1380 +41,6 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Cldr extends AbstractLocale
+class Intl extends AbstractLocale
{
- /**
- * Locale files
- *
- * @var ressource
- * @access private
- */
- private static $_ldml = array();
-
- /**
- * List of values which are collected
- *
- * @var array
- * @access private
- */
- private static $_list = array();
-
- /**
- * Internal cache for ldml values
- *
- * @var \Zend\Cache\Core
- * @access private
- */
- private static $_cache = null;
-
- /**
- * Internal option, cache disabled
- *
- * @var boolean
- * @access private
- */
- private static $_cacheDisabled = false;
-
- /**
- * Read the content from locale
- *
- * Can be called like:
- *
- * test
- * content
- * content2
- *
- *
- *
- * Case 1: _readFile('ar','/ldml/delimiter') -> returns [] = test
- * Case 1: _readFile('ar','/ldml/second[@type=myone]') -> returns [] = content
- * Case 2: _readFile('ar','/ldml/second','type') -> returns [myone] = content; [mysecond] = content2
- * Case 3: _readFile('ar','/ldml/delimiter',,'right') -> returns [right] = test
- * Case 4: _readFile('ar','/ldml/third','type','myone') -> returns [myone] = mythird
- *
- * @param string $locale
- * @param string $path
- * @param string $attribute
- * @param string $value
- * @access private
- * @return array
- */
- private static function _readFile($locale, $path, $attribute, $value, $temp)
- {
- // without attribute - read all values
- // with attribute - read only this value
- if (!empty(self::$_ldml[(string) $locale])) {
-
- $result = self::$_ldml[(string) $locale]->xpath($path);
- if (!empty($result)) {
- foreach ($result as &$found) {
-
- if (empty($value)) {
-
- if (empty($attribute)) {
- // Case 1
- $temp[] = (string) $found;
- } else if (empty($temp[(string) $found[$attribute]])){
- // Case 2
- $temp[(string) $found[$attribute]] = (string) $found;
- }
-
- } else if (empty ($temp[$value])) {
-
- if (empty($attribute)) {
- // Case 3
- $temp[$value] = (string) $found;
- } else {
- // Case 4
- $temp[$value] = (string) $found[$attribute];
- }
-
- }
- }
- }
- }
- return $temp;
- }
-
- /**
- * Find possible routing to other path or locale
- *
- * @param string $locale
- * @param string $path
- * @param string $attribute
- * @param string $value
- * @param array $temp
- * @access private
- */
- private static function _findRoute($locale, $path, $attribute, $value, &$temp)
- {
- // load locale file if not already in cache
- // needed for alias tag when referring to other locale
- if (empty(self::$_ldml[(string) $locale])) {
- $filename = __DIR__ . '/../../../../resources/cldr/main/' . $locale . '.xml';
- if (!file_exists($filename)) {
- throw new Exception\InvalidArgumentException(
- "Missing locale file '$filename' for '$locale' locale."
- );
- }
-
- self::$_ldml[(string) $locale] = simplexml_load_file($filename);
- }
-
- // search for 'alias' tag in the search path for redirection
- $search = '';
- $tok = strtok($path, '/');
-
- // parse the complete path
- if (!empty(self::$_ldml[(string) $locale])) {
- while ($tok !== false) {
- $search .= '/' . $tok;
- if (strpos($search, '[@') !== false) {
- while (strrpos($search, '[@') > strrpos($search, ']')) {
- $tok = strtok('/');
- if (empty($tok)) {
- $search .= '/';
- }
- $search = $search . '/' . $tok;
- }
- }
- $result = self::$_ldml[(string) $locale]->xpath($search . '/alias');
-
- // alias found
- if (!empty($result)) {
-
- $source = $result[0]['source'];
- $newpath = $result[0]['path'];
-
- // new path - path //ldml is to ignore
- if ($newpath != '//ldml') {
- // other path - parse to make real path
-
- while (substr($newpath,0,3) == '../') {
- $newpath = substr($newpath, 3);
- $search = substr($search, 0, strrpos($search, '/'));
- }
-
- // truncate ../ to realpath otherwise problems with alias
- $path = $search . '/' . $newpath;
- while (($tok = strtok('/'))!== false) {
- $path = $path . '/' . $tok;
- }
- }
-
- // reroute to other locale
- if ($source != 'locale') {
- $locale = $source;
- }
-
- $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
- return false;
- }
-
- $tok = strtok('/');
- }
- }
- return true;
- }
-
- /**
- * Read the right LDML file
- *
- * @param string $locale
- * @param string $path
- * @param string $attribute
- * @param string $value
- * @access private
- */
- private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array())
- {
- $result = self::_findRoute($locale, $path, $attribute, $value, $temp);
- if ($result) {
- $temp = self::_readFile($locale, $path, $attribute, $value, $temp);
- }
-
- // parse required locales reversive
- // example: when given zh_Hans_CN
- // 1. -> zh_Hans_CN
- // 2. -> zh_Hans
- // 3. -> zh
- // 4. -> root
- if (($locale != 'root') && ($result)) {
- $locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
- if (!empty($locale)) {
- $temp = self::_getFile($locale, $path, $attribute, $value, $temp);
- } else {
- $temp = self::_getFile('root', $path, $attribute, $value, $temp);
- }
- }
- return $temp;
- }
-
- /**
- * Find the details for supplemental calendar datas
- *
- * @param string $locale Locale for Detaildata
- * @param array $list List to search
- * @return string Key for Detaildata
- */
- private static function _calendarDetail($locale, $list)
- {
- $ret = "001";
- foreach ($list as $key => $value) {
- if (strpos($locale, '_') !== false) {
- $locale = substr($locale, strpos($locale, '_') + 1);
- }
- if (strpos($key, $locale) !== false) {
- $ret = $key;
- break;
- }
- }
- return $ret;
- }
-
- /**
- * Internal function for checking the locale
- *
- * @param string|\Zend\Locale $locale Locale to check
- * @return string
- */
- private static function _checkLocale($locale)
- {
- if (empty($locale)) {
- $locale = new Locale();
- }
-
- if (!(Locale::isLocale((string) $locale))) {
- throw new InvalidArgumentException(
- "Locale (" . (string) $locale . ") is a unknown locale"
- );
- }
-
- return (string) $locale;
- }
-
- /**
- * Read the LDML file, get a array of multipath defined value
- *
- * @param string $locale
- * @param string $path
- * @param string $value
- * @throws \Zend\Locale\Exception\InvalidArgumentException
- * @return array
- */
- public static function getList($locale, $path, $value = false)
- {
- $locale = self::_checkLocale($locale);
-
- if (!isset(self::$_cache) && !self::$_cacheDisabled) {
- self::$_cache = Cache::factory(
- 'Core',
- 'File',
- array('automatic_serialization' => true),
- array());
- }
-
- $val = $value;
- if (is_array($value)) {
- $val = implode('_' , $value);
- }
-
- $val = urlencode($val);
- $id = strtr('Zend_LocaleL_' . $locale . '_' . $path . '_' . $val, array('-' => '_', '%' => '_', '+' => '_'));
- if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) {
- return unserialize($result);
- }
-
- $temp = array();
- switch(strtolower($path)) {
- case 'language':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language', 'type');
- break;
-
- case 'script':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/scripts/script', 'type');
- break;
-
- case 'territory':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/territories/territory', 'type');
- if ($value === 1) {
- foreach($temp as $key => $value) {
- if ((is_numeric($key) === false) and ($key != 'QO') and ($key != 'QU')) {
- unset($temp[$key]);
- }
- }
- } else if ($value === 2) {
- foreach($temp as $key => $value) {
- if (is_numeric($key) or ($key == 'QO') or ($key == 'QU')) {
- unset($temp[$key]);
- }
- }
- }
- break;
-
- case 'variant':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/variants/variant', 'type');
- break;
-
- case 'key':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/keys/key', 'type');
- break;
-
- case 'type':
- if (empty($type)) {
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/types/type', 'type');
- } else {
- if (($value == 'calendar') or
- ($value == 'collation') or
- ($value == 'currency')) {
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/types/type[@key=\'' . $value . '\']', 'type');
- } else {
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/types/type[@type=\'' . $value . '\']', 'type');
- }
- }
- break;
-
- case 'layout':
- $temp = self::_getFile($locale, '/ldml/layout/orientation', 'lines', 'lines');
- $temp += self::_getFile($locale, '/ldml/layout/orientation', 'characters', 'characters');
- $temp += self::_getFile($locale, '/ldml/layout/inList', '', 'inList');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'currency\']', '', 'currency');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'dayWidth\']', '', 'dayWidth');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'fields\']', '', 'fields');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'keys\']', '', 'keys');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'languages\']', '', 'languages');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'long\']', '', 'long');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'measurementSystemNames\']', '', 'measurementSystemNames');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'monthWidth\']', '', 'monthWidth');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'quarterWidth\']', '', 'quarterWidth');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'scripts\']', '', 'scripts');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'territories\']', '', 'territories');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'types\']', '', 'types');
- $temp += self::_getFile($locale, '/ldml/layout/inText[@type=\'variants\']', '', 'variants');
- break;
-
- case 'characters':
- $temp = self::_getFile($locale, '/ldml/characters/exemplarCharacters', '', 'characters');
- $temp += self::_getFile($locale, '/ldml/characters/exemplarCharacters[@type=\'auxiliary\']', '', 'auxiliary');
- $temp += self::_getFile($locale, '/ldml/characters/exemplarCharacters[@type=\'currencySymbol\']', '', 'currencySymbol');
- break;
-
- case 'delimiters':
- $temp = self::_getFile($locale, '/ldml/delimiters/quotationStart', '', 'quoteStart');
- $temp += self::_getFile($locale, '/ldml/delimiters/quotationEnd', '', 'quoteEnd');
- $temp += self::_getFile($locale, '/ldml/delimiters/alternateQuotationStart', '', 'quoteStartAlt');
- $temp += self::_getFile($locale, '/ldml/delimiters/alternateQuotationEnd', '', 'quoteEndAlt');
- break;
-
- case 'measurement':
- $temp = self::_getFile('supplementalData', '/supplementalData/measurementData/measurementSystem[@type=\'metric\']', 'territories', 'metric');
- $temp += self::_getFile('supplementalData', '/supplementalData/measurementData/measurementSystem[@type=\'US\']', 'territories', 'US');
- $temp += self::_getFile('supplementalData', '/supplementalData/measurementData/paperSize[@type=\'A4\']', 'territories', 'A4');
- $temp += self::_getFile('supplementalData', '/supplementalData/measurementData/paperSize[@type=\'US-Letter\']', 'territories', 'US-Letter');
- break;
-
- case 'months':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/default', 'choice', 'context');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/default', 'choice', 'default');
- $temp['format']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/monthWidth[@type=\'abbreviated\']/month', 'type');
- $temp['format']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/monthWidth[@type=\'narrow\']/month', 'type');
- $temp['format']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/monthWidth[@type=\'wide\']/month', 'type');
- $temp['stand-alone']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'stand-alone\']/monthWidth[@type=\'abbreviated\']/month', 'type');
- $temp['stand-alone']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'stand-alone\']/monthWidth[@type=\'narrow\']/month', 'type');
- $temp['stand-alone']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'stand-alone\']/monthWidth[@type=\'wide\']/month', 'type');
- break;
-
- case 'month':
- if (empty($value)) {
- $value = array("gregorian", "format", "wide");
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/months/monthContext[@type=\'' . $value[1] . '\']/monthWidth[@type=\'' . $value[2] . '\']/month', 'type');
- break;
-
- case 'days':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/default', 'choice', 'context');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/default', 'choice', 'default');
- $temp['format']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/dayWidth[@type=\'abbreviated\']/day', 'type');
- $temp['format']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/dayWidth[@type=\'narrow\']/day', 'type');
- $temp['format']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/dayWidth[@type=\'wide\']/day', 'type');
- $temp['stand-alone']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'stand-alone\']/dayWidth[@type=\'abbreviated\']/day', 'type');
- $temp['stand-alone']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'stand-alone\']/dayWidth[@type=\'narrow\']/day', 'type');
- $temp['stand-alone']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'stand-alone\']/dayWidth[@type=\'wide\']/day', 'type');
- break;
-
- case 'day':
- if (empty($value)) {
- $value = array("gregorian", "format", "wide");
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/days/dayContext[@type=\'' . $value[1] . '\']/dayWidth[@type=\'' . $value[2] . '\']/day', 'type');
- break;
-
- case 'week':
- $minDays = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/minDays', 'territories'));
- $firstDay = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/firstDay', 'territories'));
- $weekStart = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/weekendStart', 'territories'));
- $weekEnd = self::_calendarDetail($locale, self::_getFile('supplementalData', '/supplementalData/weekData/weekendEnd', 'territories'));
-
- $temp = self::_getFile('supplementalData', "/supplementalData/weekData/minDays[@territories='" . $minDays . "']", 'count', 'minDays');
- $temp += self::_getFile('supplementalData', "/supplementalData/weekData/firstDay[@territories='" . $firstDay . "']", 'day', 'firstDay');
- $temp += self::_getFile('supplementalData', "/supplementalData/weekData/weekendStart[@territories='" . $weekStart . "']", 'day', 'weekendStart');
- $temp += self::_getFile('supplementalData', "/supplementalData/weekData/weekendEnd[@territories='" . $weekEnd . "']", 'day', 'weekendEnd');
- break;
-
- case 'quarters':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp['format']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'format\']/quarterWidth[@type=\'abbreviated\']/quarter', 'type');
- $temp['format']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'format\']/quarterWidth[@type=\'narrow\']/quarter', 'type');
- $temp['format']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'format\']/quarterWidth[@type=\'wide\']/quarter', 'type');
- $temp['stand-alone']['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'stand-alone\']/quarterWidth[@type=\'abbreviated\']/quarter', 'type');
- $temp['stand-alone']['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'stand-alone\']/quarterWidth[@type=\'narrow\']/quarter', 'type');
- $temp['stand-alone']['wide'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/quarters/quarterContext[@type=\'stand-alone\']/quarterWidth[@type=\'wide\']/quarter', 'type');
- break;
-
- case 'quarter':
- if (empty($value)) {
- $value = array("gregorian", "format", "wide");
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/quarters/quarterContext[@type=\'' . $value[1] . '\']/quarterWidth[@type=\'' . $value[2] . '\']/quarter', 'type');
- break;
-
- case 'eras':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp['names'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/eras/eraNames/era', 'type');
- $temp['abbreviated'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/eras/eraAbbr/era', 'type');
- $temp['narrow'] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/eras/eraNarrow/era', 'type');
- break;
-
- case 'era':
- if (empty($value)) {
- $value = array("gregorian", "Abbr");
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/eras/era' . $value[1] . '/era', 'type');
- break;
-
- case 'date':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'full\']/dateFormat/pattern', '', 'full');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'long\']/dateFormat/pattern', '', 'long');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'medium\']/dateFormat/pattern', '', 'medium');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'short\']/dateFormat/pattern', '', 'short');
- break;
-
- case 'time':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'full\']/timeFormat/pattern', '', 'full');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'long\']/timeFormat/pattern', '', 'long');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'medium\']/timeFormat/pattern', '', 'medium');
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'short\']/timeFormat/pattern', '', 'short');
- break;
-
- case 'datetime':
- if (empty($value)) {
- $value = "gregorian";
- }
-
- $timefull = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'full\']/timeFormat/pattern', '', 'full');
- $timelong = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'long\']/timeFormat/pattern', '', 'long');
- $timemedi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'medium\']/timeFormat/pattern', '', 'medi');
- $timeshor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/timeFormatLength[@type=\'short\']/timeFormat/pattern', '', 'shor');
-
- $datefull = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'full\']/dateFormat/pattern', '', 'full');
- $datelong = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'long\']/dateFormat/pattern', '', 'long');
- $datemedi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'medium\']/dateFormat/pattern', '', 'medi');
- $dateshor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/dateFormatLength[@type=\'short\']/dateFormat/pattern', '', 'shor');
-
- $full = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'full\']/dateTimeFormat/pattern', '', 'full');
- $long = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'long\']/dateTimeFormat/pattern', '', 'long');
- $medi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'medium\']/dateTimeFormat/pattern', '', 'medi');
- $shor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'short\']/dateTimeFormat/pattern', '', 'shor');
-
- $temp['full'] = str_replace(array('{0}', '{1}'), array($timefull['full'], $datefull['full']), $full['full']);
- $temp['long'] = str_replace(array('{0}', '{1}'), array($timelong['long'], $datelong['long']), $long['long']);
- $temp['medium'] = str_replace(array('{0}', '{1}'), array($timemedi['medi'], $datemedi['medi']), $medi['medi']);
- $temp['short'] = str_replace(array('{0}', '{1}'), array($timeshor['shor'], $dateshor['shor']), $shor['shor']);
- break;
-
- case 'dateitem':
- if (empty($value)) {
- $value = "gregorian";
- }
- $_temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/availableFormats/dateFormatItem', 'id');
- foreach($_temp as $key => $found) {
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/availableFormats/dateFormatItem[@id=\'' . $key . '\']', '', $key);
- }
- break;
-
- case 'dateinterval':
- if (empty($value)) {
- $value = "gregorian";
- }
- $_temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/intervalFormats/intervalFormatItem', 'id');
- foreach($_temp as $key => $found) {
- $temp[$key] = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/intervalFormats/intervalFormatItem[@id=\'' . $key . '\']/greatestDifference', 'id');
- }
- break;
-
- case 'field':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp2 = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/fields/field', 'type');
- foreach ($temp2 as $key => $keyvalue) {
- $temp += self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/fields/field[@type=\'' . $key . '\']/displayName', '', $key);
- }
- break;
-
- case 'relative':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/fields/field/relative', 'type');
- break;
-
- case 'symbols':
- $temp = self::_getFile($locale, '/ldml/numbers/symbols/decimal', '', 'decimal');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/group', '', 'group');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/list', '', 'list');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/percentSign', '', 'percent');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/nativeZeroDigit', '', 'zero');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/patternDigit', '', 'pattern');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/plusSign', '', 'plus');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/minusSign', '', 'minus');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/exponential', '', 'exponent');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/perMille', '', 'mille');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/infinity', '', 'infinity');
- $temp += self::_getFile($locale, '/ldml/numbers/symbols/nan', '', 'nan');
- break;
-
- case 'nametocurrency':
- $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
- }
- break;
-
- case 'currencytoname':
- $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
- foreach ($_temp as $key => $keyvalue) {
- $val = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
- if (!isset($val[$key])) {
- continue;
- }
- if (!isset($temp[$val[$key]])) {
- $temp[$val[$key]] = $key;
- } else {
- $temp[$val[$key]] .= " " . $key;
- }
- }
- break;
-
- case 'currencysymbol':
- $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/symbol', '', $key);
- }
- break;
-
- case 'question':
- $temp = self::_getFile($locale, '/ldml/posix/messages/yesstr', '', 'yes');
- $temp += self::_getFile($locale, '/ldml/posix/messages/nostr', '', 'no');
- break;
-
- case 'currencyfraction':
- $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info', 'iso4217');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $key . '\']', 'digits', $key);
- }
- break;
-
- case 'currencyrounding':
- $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info', 'iso4217');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $key . '\']', 'rounding', $key);
- }
- break;
-
- case 'currencytoregion':
- $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
- }
- break;
-
- case 'regiontocurrency':
- $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166');
- foreach ($_temp as $key => $keyvalue) {
- $val = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
- if (!isset($val[$key])) {
- continue;
- }
- if (!isset($temp[$val[$key]])) {
- $temp[$val[$key]] = $key;
- } else {
- $temp[$val[$key]] .= " " . $key;
- }
- }
- break;
-
- case 'regiontoterritory':
- $_temp = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key);
- }
- break;
-
- case 'territorytoregion':
- $_temp2 = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key);
- }
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'scripttolanguage':
- $_temp = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key);
- if (empty($temp[$key])) {
- unset($temp[$key]);
- }
- }
- break;
-
- case 'languagetoscript':
- $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key);
- }
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if (empty($found3)) {
- continue;
- }
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'territorytolanguage':
- $_temp = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key);
- if (empty($temp[$key])) {
- unset($temp[$key]);
- }
- }
- break;
-
- case 'languagetoterritory':
- $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key);
- }
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if (empty($found3)) {
- continue;
- }
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'timezonetowindows':
- $_temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/mapTimezones[@type=\'windows\']/mapZone', 'other');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/timezoneData/mapTimezones[@type=\'windows\']/mapZone[@other=\'' . $key . '\']', 'type', $key);
- }
- break;
-
- case 'windowstotimezone':
- $_temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/mapTimezones[@type=\'windows\']/mapZone', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/timezoneData/mapTimezones[@type=\'windows\']/mapZone[@type=\'' .$key . '\']', 'other', $key);
- }
- break;
-
- case 'territorytotimezone':
- $_temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/zoneFormatting/zoneItem', 'type');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/timezoneData/zoneFormatting/zoneItem[@type=\'' . $key . '\']', 'territory', $key);
- }
- break;
-
- case 'timezonetoterritory':
- $_temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/zoneFormatting/zoneItem', 'territory');
- foreach ($_temp as $key => $found) {
- $temp += self::_getFile('supplementalData', '/supplementalData/timezoneData/zoneFormatting/zoneItem[@territory=\'' . $key . '\']', 'type', $key);
- }
- break;
-
- case 'citytotimezone':
- $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type');
- foreach($_temp as $key => $found) {
- $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key);
- }
- break;
-
- case 'timezonetocity':
- $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type');
- $temp = array();
- foreach($_temp as $key => $found) {
- $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key);
- if (!empty($temp[$key])) {
- $temp[$temp[$key]] = $key;
- }
- unset($temp[$key]);
- }
- break;
-
- case 'phonetoterritory':
- $_temp = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key);
- }
- break;
-
- case 'territorytophone':
- $_temp = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory');
- foreach ($_temp as $key => $keyvalue) {
- $val = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key);
- if (!isset($val[$key])) {
- continue;
- }
- if (!isset($temp[$val[$key]])) {
- $temp[$val[$key]] = $key;
- } else {
- $temp[$val[$key]] .= " " . $key;
- }
- }
- break;
-
- case 'numerictoterritory':
- $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'type');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\'' . $key . '\']', 'numeric', $key);
- }
- break;
-
- case 'territorytonumeric':
- $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'numeric');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@numeric=\'' . $key . '\']', 'type', $key);
- }
- break;
-
- case 'alpha3toterritory':
- $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'type');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\'' . $key . '\']', 'alpha3', $key);
- }
- break;
-
- case 'territorytoalpha3':
- $_temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes', 'alpha3');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@alpha3=\'' . $key . '\']', 'type', $key);
- }
- break;
-
- case 'postaltoterritory':
- $_temp = self::_getFile('postalCodeData', '/supplementalData/postalCodeData/postCodeRegex', 'territoryId');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('postalCodeData', '/supplementalData/postalCodeData/postCodeRegex[@territoryId=\'' . $key . '\']', 'territoryId');
- }
- break;
-
- case 'numberingsystem':
- $_temp = self::_getFile('numberingSystems', '/supplementalData/numberingSystems/numberingSystem', 'id');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('numberingSystems', '/supplementalData/numberingSystems/numberingSystem[@id=\'' . $key . '\']', 'digits', $key);
- if (empty($temp[$key])) {
- unset($temp[$key]);
- }
- }
- break;
-
- case 'chartofallback':
- $_temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character', 'value');
- foreach ($_temp as $key => $keyvalue) {
- $temp2 = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $key . '\']/substitute', '', $key);
- $temp[current($temp2)] = $key;
- }
- break;
-
- case 'fallbacktochar':
- $_temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character', 'value');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $key . '\']/substitute', '', $key);
- }
- break;
-
- case 'localeupgrade':
- $_temp = self::_getFile('likelySubtags', '/supplementalData/likelySubtags/likelySubtag', 'from');
- foreach ($_temp as $key => $keyvalue) {
- $temp += self::_getFile('likelySubtags', '/supplementalData/likelySubtags/likelySubtag[@from=\'' . $key . '\']', 'to', $key);
- }
- break;
-
- case 'unit':
- $_temp = self::_getFile($locale, '/ldml/units/unit', 'type');
- foreach($_temp as $key => $keyvalue) {
- $_temp2 = self::_getFile($locale, '/ldml/units/unit[@type=\'' . $key . '\']/unitPattern', 'count');
- $temp[$key] = $_temp2;
- }
- break;
-
- default :
- throw new Exception\InvalidArgumentException(
- "Unknown list ($path) for parsing locale data."
- );
- break;
- }
-
- if (isset(self::$_cache)) {
- self::$_cache->save( serialize($temp), $id);
- }
-
- return $temp;
- }
-
- /**
- * Read the LDML file, get a single path defined value
- *
- * @param string $locale
- * @param string $path
- * @param string $value
- * @throws \Zend\Locale\Exception\InvalidArgumentException
- * @return string
- */
- public static function getContent($locale, $path, $value = false)
- {
- $locale = self::_checkLocale($locale);
-
- if (!isset(self::$_cache) && !self::$_cacheDisabled) {
- self::$_cache = Cache::factory(
- 'Core',
- 'File',
- array('automatic_serialization' => true),
- array());
- }
-
- $val = $value;
- if (is_array($value)) {
- $val = implode('_' , $value);
- }
- $val = urlencode($val);
- $id = strtr('Zend_LocaleC_' . $locale . '_' . $path . '_' . $val, array('-' => '_', '%' => '_', '+' => '_'));
- if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) {
- return unserialize($result);
- }
-
- switch(strtolower($path)) {
- case 'language':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language[@type=\'' . $value . '\']', 'type');
- break;
-
- case 'script':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/scripts/script[@type=\'' . $value . '\']', 'type');
- break;
-
- case 'country':
- case 'territory':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/territories/territory[@type=\'' . $value . '\']', 'type');
- break;
-
- case 'variant':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/variants/variant[@type=\'' . $value . '\']', 'type');
- break;
-
- case 'key':
- $temp = self::_getFile($locale, '/ldml/localeDisplayNames/keys/key[@type=\'' . $value . '\']', 'type');
- break;
-
- case 'defaultcalendar':
- $temp = self::_getFile($locale, '/ldml/dates/calendars/default', 'choice', 'default');
- break;
-
- case 'monthcontext':
- if (empty ($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/default', 'choice', 'context');
- break;
-
- case 'defaultmonth':
- if (empty ($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/months/monthContext[@type=\'format\']/default', 'choice', 'default');
- break;
-
- case 'month':
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", "format", "wide", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/months/monthContext[@type=\'' . $value[1] . '\']/monthWidth[@type=\'' . $value[2] . '\']/month[@type=\'' . $value[3] . '\']', 'type');
- break;
-
- case 'daycontext':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/default', 'choice', 'context');
- break;
-
- case 'defaultday':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/days/dayContext[@type=\'format\']/default', 'choice', 'default');
- break;
-
- case 'day':
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", "format", "wide", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/days/dayContext[@type=\'' . $value[1] . '\']/dayWidth[@type=\'' . $value[2] . '\']/day[@type=\'' . $value[3] . '\']', 'type');
- break;
-
- case 'quarter':
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", "format", "wide", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/quarters/quarterContext[@type=\'' . $value[1] . '\']/quarterWidth[@type=\'' . $value[2] . '\']/quarter[@type=\'' . $value[3] . '\']', 'type');
- break;
-
- case 'am':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/am', '', 'am');
- break;
-
- case 'pm':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/pm', '', 'pm');
- break;
-
- case 'era':
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", "Abbr", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/eras/era' . $value[1] . '/era[@type=\'' . $value[2] . '\']', 'type');
- break;
-
- case 'defaultdate':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateFormats/default', 'choice', 'default');
- break;
-
- case 'date':
- if (empty($value)) {
- $value = array("gregorian", "medium");
- }
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateFormats/dateFormatLength[@type=\'' . $value[1] . '\']/dateFormat/pattern', '', 'pattern');
- break;
-
- case 'defaulttime':
- if (empty($value)) {
- $value = "gregorian";
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/timeFormats/default', 'choice', 'default');
- break;
-
- case 'time':
- if (empty($value)) {
- $value = array("gregorian", "medium");
- }
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/timeFormats/timeFormatLength[@type=\'' . $value[1] . '\']/timeFormat/pattern', '', 'pattern');
- break;
-
- case 'datetime':
- if (empty($value)) {
- $value = array("gregorian", "medium");
- }
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp);
- }
-
- $date = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateFormats/dateFormatLength[@type=\'' . $value[1] . '\']/dateFormat/pattern', '', 'pattern');
- $time = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/timeFormats/timeFormatLength[@type=\'' . $value[1] . '\']/timeFormat/pattern', '', 'pattern');
- $datetime = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'' . $value[1] . '\']/dateTimeFormat/pattern', '', 'pattern');
- $temp = str_replace(array('{0}', '{1}'), array(current($time), current($date)), current($datetime));
- break;
-
- case 'dateitem':
- if (empty($value)) {
- $value = array("gregorian", "yyMMdd");
- }
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/availableFormats/dateFormatItem[@id=\'' . $value[1] . '\']', '');
- break;
-
- case 'dateinterval':
- if (empty($value)) {
- $value = array("gregorian", "yMd", "y");
- }
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp, $temp[0]);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/intervalFormats/intervalFormatItem[@id=\'' . $value[1] . '\']/greatestDifference[@id=\'' . $value[2] . '\']', '');
- break;
-
- case 'field':
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/fields/field[@type=\'' . $value[1] . '\']/displayName', '', $value[1]);
- break;
-
- case 'relative':
- if (!is_array($value)) {
- $temp = $value;
- $value = array("gregorian", $temp);
- }
- $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/fields/field/relative[@type=\'' . $value[1] . '\']', '', $value[1]);
- break;
-
- case 'decimalnumber':
- $temp = self::_getFile($locale, '/ldml/numbers/decimalFormats/decimalFormatLength/decimalFormat/pattern', '', 'default');
- break;
-
- case 'scientificnumber':
- $temp = self::_getFile($locale, '/ldml/numbers/scientificFormats/scientificFormatLength/scientificFormat/pattern', '', 'default');
- break;
-
- case 'percentnumber':
- $temp = self::_getFile($locale, '/ldml/numbers/percentFormats/percentFormatLength/percentFormat/pattern', '', 'default');
- break;
-
- case 'currencynumber':
- $temp = self::_getFile($locale, '/ldml/numbers/currencyFormats/currencyFormatLength/currencyFormat/pattern', '', 'default');
- break;
-
- case 'nametocurrency':
- $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/displayName', '', $value);
- break;
-
- case 'currencytoname':
- $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/displayName', '', $value);
- $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type');
- $temp = array();
- foreach ($_temp as $key => $keyvalue) {
- $val = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
- if (!isset($val[$key]) or ($val[$key] != $value)) {
- continue;
- }
- if (!isset($temp[$val[$key]])) {
- $temp[$val[$key]] = $key;
- } else {
- $temp[$val[$key]] .= " " . $key;
- }
- }
- break;
-
- case 'currencysymbol':
- $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/symbol', '', $value);
- break;
-
- case 'question':
- $temp = self::_getFile($locale, '/ldml/posix/messages/' . $value . 'str', '', $value);
- break;
-
- case 'currencyfraction':
- if (empty($value)) {
- $value = "DEFAULT";
- }
- $temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $value . '\']', 'digits', 'digits');
- break;
-
- case 'currencyrounding':
- if (empty($value)) {
- $value = "DEFAULT";
- }
- $temp = self::_getFile('supplementalData', '/supplementalData/currencyData/fractions/info[@iso4217=\'' . $value . '\']', 'rounding', 'rounding');
- break;
-
- case 'currencytoregion':
- $temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $value . '\']/currency', 'iso4217', $value);
- break;
-
- case 'regiontocurrency':
- $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166');
- $temp = array();
- foreach ($_temp as $key => $keyvalue) {
- $val = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
- if (!isset($val[$key]) or ($val[$key] != $value)) {
- continue;
- }
- if (!isset($temp[$val[$key]])) {
- $temp[$val[$key]] = $key;
- } else {
- $temp[$val[$key]] .= " " . $key;
- }
- }
- break;
-
- case 'regiontoterritory':
- $temp = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $value . '\']', 'contains', $value);
- break;
-
- case 'territorytoregion':
- $_temp2 = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key);
- }
- $temp = array();
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if ($found3 !== $value) {
- continue;
- }
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'scripttolanguage':
- $temp = self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $value . '\']', 'scripts', $value);
- break;
-
- case 'languagetoscript':
- $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key);
- }
- $temp = array();
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if ($found3 !== $value) {
- continue;
- }
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'territorytolanguage':
- $temp = self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $value . '\']', 'territories', $value);
- break;
-
- case 'languagetoterritory':
- $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key);
- }
- $temp = array();
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if ($found3 !== $value) {
- continue;
- }
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'timezonetowindows':
- $temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/mapTimezones[@type=\'windows\']/mapZone[@other=\''.$value.'\']', 'type', $value);
- break;
-
- case 'windowstotimezone':
- $temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/mapTimezones[@type=\'windows\']/mapZone[@type=\''.$value.'\']', 'other', $value);
- break;
-
- case 'territorytotimezone':
- $temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/zoneFormatting/zoneItem[@type=\'' . $value . '\']', 'territory', $value);
- break;
-
- case 'timezonetoterritory':
- $temp = self::_getFile('supplementalData', '/supplementalData/timezoneData/zoneFormatting/zoneItem[@territory=\'' . $value . '\']', 'type', $value);
- break;
-
- case 'citytotimezone':
- $temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $value . '\']/exemplarCity', '', $value);
- break;
-
- case 'timezonetocity':
- $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type');
- $temp = array();
- foreach($_temp as $key => $found) {
- $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key);
- if (!empty($temp[$key])) {
- if ($temp[$key] == $value) {
- $temp[$temp[$key]] = $key;
- }
- }
- unset($temp[$key]);
- }
- break;
-
- case 'phonetoterritory':
- $temp = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $value . '\']/telephoneCountryCode', 'code', $value);
- break;
-
- case 'territorytophone':
- $_temp2 = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory');
- $_temp = array();
- foreach ($_temp2 as $key => $found) {
- $_temp += self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key);
- }
- $temp = array();
- foreach($_temp as $key => $found) {
- $_temp3 = explode(" ", $found);
- foreach($_temp3 as $found3) {
- if ($found3 !== $value) {
- continue;
- }
- if (!isset($temp[$found3])) {
- $temp[$found3] = (string) $key;
- } else {
- $temp[$found3] .= " " . $key;
- }
- }
- }
- break;
-
- case 'numerictoterritory':
- $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\''.$value.'\']', 'numeric', $value);
- break;
-
- case 'territorytonumeric':
- $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@numeric=\''.$value.'\']', 'type', $value);
- break;
-
- case 'alpha3toterritory':
- $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@type=\''.$value.'\']', 'alpha3', $value);
- break;
-
- case 'territorytoalpha3':
- $temp = self::_getFile('supplementalData', '/supplementalData/codeMappings/territoryCodes[@alpha3=\''.$value.'\']', 'type', $value);
- break;
-
- case 'postaltoterritory':
- $temp = self::_getFile('postalCodeData', '/supplementalData/postalCodeData/postCodeRegex[@territoryId=\'' . $value . '\']', 'territoryId');
- break;
-
- case 'numberingsystem':
- $temp = self::_getFile('numberingSystems', '/supplementalData/numberingSystems/numberingSystem[@id=\'' . strtolower($value) . '\']', 'digits', $value);
- break;
-
- case 'chartofallback':
- $_temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character', 'value');
- foreach ($_temp as $key => $keyvalue) {
- $temp2 = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $key . '\']/substitute', '', $key);
- if (current($temp2) == $value) {
- $temp = $key;
- }
- }
- break;
-
- $temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $value . '\']/substitute', '', $value);
- break;
-
- case 'fallbacktochar':
- $temp = self::_getFile('characters', '/supplementalData/characters/character-fallback/character[@value=\'' . $value . '\']/substitute', '');
- break;
-
- case 'localeupgrade':
- $temp = self::_getFile('likelySubtags', '/supplementalData/likelySubtags/likelySubtag[@from=\'' . $value . '\']', 'to', $value);
- break;
-
- case 'unit':
- $temp = self::_getFile($locale, '/ldml/units/unit[@type=\'' . $value[0] . '\']/unitPattern[@count=\'' . $value[1] . '\']', '');
- break;
-
- default :
- throw new Exception\InvalidArgumentException(
- "Unknown detail ($path) for parsing locale data."
- );
- break;
- }
-
- if (is_array($temp)) {
- $temp = current($temp);
- }
- if (isset(self::$_cache)) {
- self::$_cache->save( serialize($temp), $id);
- }
-
- return $temp;
- }
}
diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php
index 8778a93eaea..7e2b415fa6f 100644
--- a/library/Zend/Locale/Format.php
+++ b/library/Zend/Locale/Format.php
@@ -26,7 +26,7 @@
/**
* @uses \Zend\Locale\Locale
- * @uses \Zend\Locale\Data
+ * @uses \Zend\Locale\Data\Cldr
* @uses \Zend\Locale\Exception\InvalidArgumentException
* @usess \Zend\Locale\Exception\UnsupportedTokenException
* @uses \Zend\Locale\Math
@@ -99,10 +99,10 @@ private static function _checkOptions(array $options = array())
if (isset($options['locale'])) {
$locale = $options['locale'];
}
- $options['number_format'] = Data::getContent($locale, 'decimalnumber');
+ $options['number_format'] = Cldr::getContent($locale, 'decimalnumber');
} else if ((gettype($value) !== 'string') and ($value !== NULL)) {
throw new Exception\InvalidArgumentException(
- "Unknown number format type '" . gettype($value) . "'. "
+ "Unknown number format type '" . gettype($value) . "'. "
. "Format '$value' must be a valid number format string."
);
}
@@ -117,7 +117,7 @@ private static function _checkOptions(array $options = array())
$options['date_format'] = self::getDateFormat($locale);
} else if ((gettype($value) !== 'string') and ($value !== NULL)) {
throw new Exception\InvalidArgumentException(
- "Unknown dateformat type '" . gettype($value) . "'. "
+ "Unknown dateformat type '" . gettype($value) . "'. "
. "Format '$value' must be a valid ISO or PHP date format string."
);
} else {
@@ -131,7 +131,7 @@ private static function _checkOptions(array $options = array())
case 'format_type' :
if (($value != 'php') && ($value != 'iso')) {
throw new Exception\InvalidArgumentException(
- "Unknown date format type '$value'. Only 'iso' and 'php'"
+ "Unknown date format type '$value'. Only 'iso' and 'php'"
. " are supported."
);
}
@@ -140,7 +140,7 @@ private static function _checkOptions(array $options = array())
case 'fix_date' :
if (($value !== true) && ($value !== false)) {
throw new Exception\InvalidArgumentException(
- "Enabling correction of dates must be either true or false"
+ "Enabling correction of dates must be either true or false"
. "(fix_date='$value')."
);
}
@@ -152,12 +152,12 @@ private static function _checkOptions(array $options = array())
case 'cache' :
if ($value instanceof \Zend\Cache\Core) {
- Data::setCache($value);
+ Cldr::setCache($value);
}
break;
case 'disablecache' :
- Data::disableCache($value);
+ Cldr::disableCache($value);
break;
case 'precision' :
@@ -167,14 +167,14 @@ private static function _checkOptions(array $options = array())
if (($value < -1) || ($value > 30)) {
throw new Exception\InvalidArgumentException(
- "'$value' precision is not a whole number less than 30."
- );
+ "'$value' precision is not a whole number less than 30."
+ );
}
break;
default:
throw new Exception\InvalidArgumentException(
- "Unknown option: '$name' = '$value'"
+ "Unknown option: '$name' = '$value'"
);
break;
@@ -203,19 +203,19 @@ private static function _checkOptions(array $options = array())
public static function convertNumerals($input, $from, $to = null)
{
$from = strtolower($from);
- $source = Data::getContent('en', 'numberingsystem', $from);
+ $source = Cldr::getContent('en', 'numberingsystem', $from);
if (empty($source)) {
throw new Exception\InvalidArgumentException(
- "Unknown script '$from'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."
+ "Unknown script '$from'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."
);
}
if ($to !== null) {
$to = strtolower($to);
- $target = Data::getContent('en', 'numberingsystem', $to);
+ $target = Cldr::getContent('en', 'numberingsystem', $to);
if (empty($target)) {
throw new Exception\InvalidArgumentException(
- "Unknown script '$to'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."
+ "Unknown script '$to'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."
);
}
} else {
@@ -255,12 +255,12 @@ public static function getNumber($input, array $options = array())
if (!self::isNumber($input, $options)) {
throw new Exception\InvalidArgumentException(
- 'No localized value in ' . $input . ' found, or the given number does not match the localized format'
+ 'No localized value in ' . $input . ' found, or the given number does not match the localized format'
);
}
// Get correct signs for this locale
- $symbols = Data::getList($options['locale'],'symbols');
+ $symbols = Cldr::getList($options['locale'],'symbols');
// Change locale input to be default number
if ((strpos($input, $symbols['minus']) !== false) ||
(strpos($input, '-') !== false)) {
@@ -311,14 +311,14 @@ public static function toNumber($value, array $options = array())
$options['locale'] = (string) $options['locale'];
// Get correct signs for this locale
- $symbols = Data::getList($options['locale'], 'symbols');
+ $symbols = Cldr::getList($options['locale'], 'symbols');
$oenc = iconv_get_encoding('internal_encoding');
iconv_set_encoding('internal_encoding', 'UTF-8');
// Get format
$format = $options['number_format'];
if ($format === null) {
- $format = Data::getContent($options['locale'], 'decimalnumber');
+ $format = Cldr::getContent($options['locale'], 'decimalnumber');
$format = self::_seperateFormat($format, $value, $options['precision']);
if ($options['precision'] !== null) {
@@ -350,7 +350,7 @@ public static function toNumber($value, array $options = array())
if (iconv_strpos($format, '0') === false) {
iconv_set_encoding('internal_encoding', $oenc);
throw new Exception\InvalidArgumentException(
- 'Wrong format... missing 0'
+ 'Wrong format... missing 0'
);
}
@@ -510,7 +510,7 @@ public static function isNumber($input, array $options = array())
$options = self::_checkOptions($options) + self::$_options;
// Get correct signs for this locale
- $symbols = Data::getList($options['locale'],'symbols');
+ $symbols = Cldr::getList($options['locale'],'symbols');
$regexs = self::_getRegexForType('decimalnumber', $options);
$regexs = array_merge($regexs, self::_getRegexForType('scientificnumber', $options));
@@ -536,7 +536,7 @@ public static function isNumber($input, array $options = array())
*/
private static function _getRegexForType($type, $options)
{
- $decimal = Data::getContent($options['locale'], $type);
+ $decimal = Cldr::getContent($options['locale'], $type);
$decimal = preg_replace('/[^#0,;\.\-Ee]/u', '',$decimal);
$patterns = explode(';', $decimal);
@@ -544,7 +544,7 @@ private static function _getRegexForType($type, $options)
$patterns[1] = '-' . $patterns[0];
}
- $symbols = Data::getList($options['locale'],'symbols');
+ $symbols = Cldr::getList($options['locale'],'symbols');
foreach($patterns as $pkey => $pattern) {
$regex[$pkey] = '/^';
@@ -809,7 +809,7 @@ private static function _parseDate($date, $options)
(!is_object($options['locale']) || ((string) $options['locale'] !== 'root'))
) {
// erase day string
- $daylist = Data::getList($options['locale'], 'day');
+ $daylist = Cldr::getList($options['locale'], 'day');
if (is_scalar($number)) {
foreach($daylist as $key => $name) {
if (iconv_strpos($number, $name) !== false) {
@@ -828,10 +828,10 @@ private static function _parseDate($date, $options)
(!is_object($options['locale']) || ((string) $options['locale'] !== 'root'))) {
// prepare to convert month name to their numeric equivalents, if requested,
// and we have a $options['locale']
- $position = self::_replaceMonth($number, Data::getList($options['locale'],
+ $position = self::_replaceMonth($number, Cldr::getList($options['locale'],
'month'));
if ($position === false) {
- $position = self::_replaceMonth($number, Data::getList($options['locale'],
+ $position = self::_replaceMonth($number, Cldr::getList($options['locale'],
'month', array('gregorian', 'format', 'abbreviated')));
}
}
@@ -857,9 +857,9 @@ private static function _parseDate($date, $options)
// get daytime
if (iconv_strpos($format, 'a') !== false) {
- if (iconv_strpos(strtoupper($number), strtoupper(Data::getContent($options['locale'], 'am'))) !== false) {
+ if (iconv_strpos(strtoupper($number), strtoupper(Cldr::getContent($options['locale'], 'am'))) !== false) {
$am = true;
- } else if (iconv_strpos(strtoupper($number), strtoupper(Data::getContent($options['locale'], 'pm'))) !== false) {
+ } else if (iconv_strpos(strtoupper($number), strtoupper(Cldr::getContent($options['locale'], 'pm'))) !== false) {
$am = false;
}
}
@@ -1085,7 +1085,7 @@ protected static function _replaceMonth(&$number, $monthlist)
*/
public static function getDateFormat($locale = null)
{
- $format = Data::getContent($locale, 'date');
+ $format = Cldr::getContent($locale, 'date');
if (empty($format)) {
throw new Exception\InvalidArgumentException("failed to receive data from locale $locale");
}
@@ -1141,14 +1141,14 @@ public static function checkDateFormat($date, array $options = array())
$options = self::_checkOptions($options) + self::$_options;
// day expected but not parsed
- if ((iconv_strpos($options['date_format'], 'd', 0, 'UTF-8') !== false)
+ if ((iconv_strpos($options['date_format'], 'd', 0, 'UTF-8') !== false)
and (!isset($date['day']) or ($date['day'] === ""))
) {
return false;
}
// month expected but not parsed
- if ((iconv_strpos($options['date_format'], 'M', 0, 'UTF-8') !== false)
+ if ((iconv_strpos($options['date_format'], 'M', 0, 'UTF-8') !== false)
and (!isset($date['month']) or ($date['month'] === ""))
) {
return false;
@@ -1156,21 +1156,21 @@ public static function checkDateFormat($date, array $options = array())
// year expected but not parsed
if (((iconv_strpos($options['date_format'], 'Y', 0, 'UTF-8') !== false) or
- (iconv_strpos($options['date_format'], 'y', 0, 'UTF-8') !== false))
+ (iconv_strpos($options['date_format'], 'y', 0, 'UTF-8') !== false))
and (!isset($date['year']) or ($date['year'] === ""))
) {
return false;
}
// second expected but not parsed
- if ((iconv_strpos($options['date_format'], 's', 0, 'UTF-8') !== false)
+ if ((iconv_strpos($options['date_format'], 's', 0, 'UTF-8') !== false)
and (!isset($date['second']) or ($date['second'] === ""))
) {
return false;
}
// minute expected but not parsed
- if ((iconv_strpos($options['date_format'], 'm', 0, 'UTF-8') !== false)
+ if ((iconv_strpos($options['date_format'], 'm', 0, 'UTF-8') !== false)
and (!isset($date['minute']) or ($date['minute'] === ""))
) {
return false;
@@ -1178,7 +1178,7 @@ public static function checkDateFormat($date, array $options = array())
// hour expected but not parsed
if (((iconv_strpos($options['date_format'], 'H', 0, 'UTF-8') !== false) or
- (iconv_strpos($options['date_format'], 'h', 0, 'UTF-8') !== false))
+ (iconv_strpos($options['date_format'], 'h', 0, 'UTF-8') !== false))
and (!isset($date['hour']) or ($date['hour'] === ""))
) {
return false;
@@ -1196,7 +1196,7 @@ public static function checkDateFormat($date, array $options = array())
*/
public static function getTimeFormat($locale = null)
{
- $format = Data::getContent($locale, 'time');
+ $format = Cldr::getContent($locale, 'time');
if (empty($format)) {
throw new Exception\InvalidArgumentException("failed to receive data from locale $locale");
}
@@ -1234,7 +1234,7 @@ public static function getTime($time, array $options = array())
*/
public static function getDateTimeFormat($locale = null)
{
- $format = Data::getContent($locale, 'datetime');
+ $format = Cldr::getContent($locale, 'datetime');
if (empty($format)) {
throw new Exception\InvalidArgumentException("failed to receive data from locale $locale");
}
diff --git a/library/Zend/Locale/Locale.php b/library/Zend/Locale/Locale.php
index 2b32ac49ce5..459c3155432 100644
--- a/library/Zend/Locale/Locale.php
+++ b/library/Zend/Locale/Locale.php
@@ -471,7 +471,9 @@ public static function setFallback($locale, $quality = 1)
}
}
- self::$_auto = self::getBrowser() + self::getEnvironment() + self::getFallback();
+ if (empty(self::$_fixed)) {
+ self::$_auto = self::getBrowser() + self::getEnvironment() + self::getFallback();
+ }
}
/**
@@ -1132,12 +1134,12 @@ public static function disableCache($flag)
}
/**
- * Internal function, returns a single locale on detection
+ * Internal function, returns a locale fallback list on detection
*
* @param string|\Zend\Locale\Locale $locale (Optional) Locale to work on
* @param boolean $strict (Optional) Strict preparation
* @throws \Zend\Locale\Exception\UnexpectedValueException When no locale is set which is only possible when the class was wrong extended
- * @return string
+ * @return array
*/
private static function _prepareLocale($locale, $strict = false)
{
@@ -1149,7 +1151,7 @@ private static function _prepareLocale($locale, $strict = false)
return '';
}
- if (empty(self::$_auto) === true) {
+ if (empty(self::$_auto)) {
self::$_browser = self::getBrowser();
self::$_environment = self::getEnvironment();
self::$_auto = self::getBrowser() + self::getEnvironment() + self::getFallback();
diff --git a/tests/Zend/Locale/FormatTest.php b/tests/Zend/Locale/FormatTest.php
index d99633bd32c..2353968e228 100644
--- a/tests/Zend/Locale/FormatTest.php
+++ b/tests/Zend/Locale/FormatTest.php
@@ -24,7 +24,7 @@
use \Zend\Locale\Format,
\Zend\Locale\Exception\InvalidArgumentException,
\Zend\Locale\Locale,
- \Zend\Locale\Data;
+ \Zend\Locale\Data\Cldr;
/**
* @category Zend
@@ -767,7 +767,7 @@ public function testSetOption()
}
$format = Format::setOptions(array('locale' => 'de', 'number_format' => Format::STANDARD));
- $test = Data::getContent('de', 'decimalnumber');
+ $test = Cldr::getContent('de', 'decimalnumber');
$this->assertEquals($test, $format['number_format']);
try {
diff --git a/tests/Zend/Measure/TemperatureTest.php b/tests/Zend/Measure/TemperatureTest.php
index 1a9eaca30ec..7566d539dd9 100644
--- a/tests/Zend/Measure/TemperatureTest.php
+++ b/tests/Zend/Measure/TemperatureTest.php
@@ -25,7 +25,7 @@
namespace ZendTest\Measure;
use Zend\Measure;
use Zend\Registry;
-use Zend\Locale\Data;
+use Zend\Locale\Data\Cldr;
/**
* @category Zend
@@ -43,7 +43,7 @@ public function setUp()
$registry = Registry::getInstance();
unset($registry['Zend_Locale']);
}
- Data::removeCache();
+ Cldr::removeCache();
$this->_locale = setlocale(LC_ALL, 0);
setlocale(LC_ALL, 'de');