CLocale
| 鍖 | system.i18n |
|---|---|
| 缁ф壙 | class CLocale » CComponent |
| 婧愯嚜 | 1.0 |
| 鐗堟湰 | $Id: CLocale.php 3518 2011-12-28 23:31:29Z alexander.makarow $ |
| 婧愮爜 | framework/i18n/CLocale.php |
CLocale浠h〃涓涓尯鍩熺殑鐩稿叧鏁版嵁銆
杩欎簺鏁版嵁鍖呮嫭鏁板瓧鏍煎紡鍜屾棩鏈熸牸寮忎俊鎭
杩欎簺鏁版嵁鍖呮嫭鏁板瓧鏍煎紡鍜屾棩鏈熸牸寮忎俊鎭
鍏叡灞炴
| 灞炴 | 绫诲瀷 | 鎻忚堪 | 瀹氫箟鍦 |
|---|---|---|---|
| aMName | string | AM鍚嶇О | CLocale |
| currencyFormat | string | 璐у竵鏍煎紡 | CLocale |
| dataPath | string | 鐩綍鍖呭惈鐫鍖哄煙鏁版嵁銆 濡傛灉鏈缃灞炴э紝鍖哄煙鏁版嵁灏嗕粠鈥榝ramework/i18n/data鈥欏姞杞姐 | CLocale |
| dateFormat | string | 鏃ユ湡鏍煎紡 | CLocale |
| dateFormatter | CDateFormatter | 杩斿洖杩欎釜鍖哄煙鐨勬棩鏈熸牸寮 | CLocale |
| dateTimeFormat | string | 鏃ユ湡鏃堕棿鏍煎紡锛屾瘮濡傦細鏃ユ湡鍜屾椂闂寸殑椤哄簭銆 | CLocale |
| decimalFormat | string | 鍗佽繘鍒舵牸寮 | CLocale |
| id | string | 鍖哄煙ID锛堝吀鍨嬫牸寮忥級 | CLocale |
| localeDisplayName | string | 鑾峰彇鏈湴鍖杋18鏁版嵁鏂囦欢鍦紙framework/i18n/data/ files)銆 | CLocale |
| monthNames | array | 杩斿洖鎸囧畾瀹藉害鐨勬湀浠藉悕绉般 | CLocale |
| numberFormatter | CNumberFormatter | 杩斿洖杩欎釜鍖哄煙鐨勬暟瀛楁牸寮 | CLocale |
| orientation | string | 鏂囧瓧鏂瑰悜锛岃涔堟槸鈥榣tr鈥欙紙浠庡乏鍒板彸锛夛紝瑕佷箞鏄榬tl鈥欙紙浠庡彸鍒板乏锛夈 | CLocale |
| pMName | string | PM鍚嶇О | CLocale |
| percentFormat | string | 鐧惧垎姣旀牸寮 | CLocale |
| pluralRules | array | 澶嶆暟褰㈠紡琛ㄨ揪寮 | CLocale |
| scientificFormat | string | 绉戝璁版暟娉曟牸寮 | CLocale |
| timeFormat | string | 鏃ユ湡鏍煎紡 | CLocale |
| weekDayNames | array | 杩斿洖鎸囧畾瀹藉害鐨勬槦鏈熷悕瀛椼 | CLocale |
鍏叡鏂规硶
| 鏂规硶 | 鎻忚堪 | 瀹氫箟鍦 |
|---|---|---|
| __call() | 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 | CComponent |
| __get() | 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 | CComponent |
| __isset() | 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 | CComponent |
| __set() | 璁剧疆涓涓粍浠剁殑灞炴у笺 | CComponent |
| __unset() | 璁剧疆涓涓粍浠剁殑灞炴т负null銆 | CComponent |
| asa() | 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° | CComponent |
| attachBehavior() | 闄勫姞涓涓涓哄埌缁勪欢銆 | CComponent |
| attachBehaviors() | 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 | CComponent |
| attachEventHandler() | 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 | CComponent |
| canGetProperty() | 纭畾灞炴ф槸鍚﹀彲璇汇 | CComponent |
| canSetProperty() | 纭畾灞炴ф槸鍚﹀彲鍐欍 | CComponent |
| detachBehavior() | 浠庣粍浠朵腑鍒嗙涓涓涓恒 | CComponent |
| detachBehaviors() | 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 | CComponent |
| detachEventHandler() | 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 | CComponent |
| disableBehavior() | 绂佺敤涓涓檮鍔犺涓恒 | CComponent |
| disableBehaviors() | 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 | CComponent |
| enableBehavior() | 鍚敤涓涓檮鍔犺涓恒 | CComponent |
| enableBehaviors() | 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 | CComponent |
| evaluateExpression() | 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 | CComponent |
| getAMName() | 杩斿洖AM鍚嶇О | CLocale |
| getCanonicalID() | 杞崲鍖哄煙ID涓哄吀鍨嬫牸寮忋 | CLocale |
| getCurrencyFormat() | 杩斿洖璐у竵鏍煎紡 | CLocale |
| getCurrencySymbol() | 杩斿洖璇ュ尯鍩熺殑璐у竵绗﹀彿锛屽鏋滅鍙蜂笉瀛樺湪鍒欒繑鍥瀗ull銆 | CLocale |
| getDateFormat() | 杩斿洖鏃ユ湡鏍煎紡 | CLocale |
| getDateFormatter() | 杩斿洖杩斿洖杩欎釜鍖哄煙鐨勬棩鏈熸牸寮 | CLocale |
| getDateTimeFormat() | 杩斿洖鏃ユ湡鏃堕棿鏍煎紡锛屾瘮濡傦細鏃ユ湡鍜屾椂闂寸殑椤哄簭銆 | CLocale |
| getDecimalFormat() | 杩斿洖鍗佽繘鍒舵牸寮 | CLocale |
| getEraName() | 杩斿洖骞翠唬鍚嶇О | CLocale |
| getEventHandlers() | 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 | CComponent |
| getId() | 杩斿洖鍖哄煙ID锛堝吀鍨嬫牸寮忥級 | CLocale |
| getInstance() | 杩斿洖鎸囧畾鍖哄煙瀹炰緥銆 | CLocale |
| getLanguage() | 杩斿洖鏄剧ず鏈湴鍖栬瑷鍚嶇О锛屽鏋滀笉瀛樺湪杩斿洖null銆 | CLocale |
| getLanguageID() | 杞崲鍖哄煙ID涓鸿瑷ID銆 | CLocale |
| getLocaleDisplayName() | 鑾峰彇鏈湴鍖杋18鏁版嵁鏂囦欢鍦紙framework/i18n/data/ files)銆 | CLocale |
| getLocaleIDs() | 杩斿洖妗嗘灦鍙互璇嗗埆鐨勫尯鍩烮D銆 | CLocale |
| getMonthName() | 杩斿洖鏈堜唤鍚嶇О | CLocale |
| getMonthNames() | 杩斿洖鎸囧畾瀹藉害鐨勬湀浠藉悕绉般 | CLocale |
| getNumberFormatter() | 杩斿洖杩斿洖杩欎釜鍖哄煙鐨勬暟瀛楁牸寮 | CLocale |
| getNumberSymbol() | 杩斿洖绗﹀彿 | CLocale |
| getOrientation() | 杩斿洖鏂囧瓧鏂瑰悜锛岃涔堟槸鈥榣tr鈥欙紙浠庡乏鍒板彸锛夛紝瑕佷箞鏄榬tl鈥欙紙浠庡彸鍒板乏锛夈 | CLocale |
| getPMName() | 杩斿洖PM鍚嶇О | CLocale |
| getPercentFormat() | 杩斿洖鐧惧垎姣旀牸寮 | CLocale |
| getPluralRules() | 杩斿洖澶嶆暟褰㈠紡琛ㄨ揪寮 | CLocale |
| getScientificFormat() | 杩斿洖绉戝璁版暟娉曟牸寮 | CLocale |
| getScript() | 杩斿洖鏄剧ず鏈湴鍖栬剼鏈悕绉帮紝濡傛灉涓嶅瓨鍦ㄨ繑鍥瀗ull銆 | CLocale |
| getScriptID() | 杞崲鍖哄煙ID涓鸿剼鏈琁D銆 | CLocale |
| getTerritory() | 杩斿洖鏄剧ず鑼冨洿鍚嶇О锛屽鏋滀笉瀛樺湪杩斿洖null銆 | CLocale |
| getTerritoryID() | 杞崲鍖哄煙ID涓鸿寖鍥碔D銆 | CLocale |
| getTimeFormat() | 杩斿洖鏃ユ湡鏍煎紡 | CLocale |
| getWeekDayName() | 杩斿洖鏄熸湡鍚嶇О | CLocale |
| getWeekDayNames() | 杩斿洖鎸囧畾瀹藉害鐨勬槦鏈熷悕瀛椼 | CLocale |
| hasEvent() | 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 | CComponent |
| hasEventHandler() | 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 | CComponent |
| hasProperty() | 纭畾灞炴ф槸鍚﹁瀹氫箟銆 | CComponent |
| raiseEvent() | 鍙戣捣涓涓簨浠躲 | CComponent |
灞炴ц缁
aMName
灞炴
鍙
public string getAMName()
AM鍚嶇О
currencyFormat
灞炴
鍙
public string getCurrencyFormat()
璐у竵鏍煎紡
dataPath
灞炴
锛堝彲鐢ㄨ嚜 v1.1.0锛
public static string $dataPath;
鐩綍鍖呭惈鐫鍖哄煙鏁版嵁銆 濡傛灉鏈缃灞炴э紝鍖哄煙鏁版嵁灏嗕粠鈥榝ramework/i18n/data鈥欏姞杞姐
dateFormat
灞炴
鍙
public string getDateFormat(string $width='medium')
鏃ユ湡鏍煎紡
dateFormatter
灞炴
鍙
public CDateFormatter getDateFormatter()
杩斿洖杩欎釜鍖哄煙鐨勬棩鏈熸牸寮
dateTimeFormat
灞炴
鍙
public string getDateTimeFormat()
鏃ユ湡鏃堕棿鏍煎紡锛屾瘮濡傦細鏃ユ湡鍜屾椂闂寸殑椤哄簭銆
decimalFormat
灞炴
鍙
public string getDecimalFormat()
鍗佽繘鍒舵牸寮
id
灞炴
鍙
public string getId()
鍖哄煙ID锛堝吀鍨嬫牸寮忥級
localeDisplayName
灞炴
鍙 锛堝彲鐢ㄨ嚜 v1.1.9锛
public string getLocaleDisplayName(string $id=NULL, string $category='languages')
鑾峰彇鏈湴鍖杋18鏁版嵁鏂囦欢鍦紙framework/i18n/data/ files)銆
monthNames
灞炴
鍙
public array getMonthNames(string $width='wide', boolean $standAlone=false)
杩斿洖鎸囧畾瀹藉害鐨勬湀浠藉悕绉般
numberFormatter
灞炴
鍙
public CNumberFormatter getNumberFormatter()
杩斿洖杩欎釜鍖哄煙鐨勬暟瀛楁牸寮
orientation
灞炴
鍙 锛堝彲鐢ㄨ嚜 v1.1.2锛
public string getOrientation()
鏂囧瓧鏂瑰悜锛岃涔堟槸鈥榣tr鈥欙紙浠庡乏鍒板彸锛夛紝瑕佷箞鏄榬tl鈥欙紙浠庡彸鍒板乏锛夈
pMName
灞炴
鍙
public string getPMName()
PM鍚嶇О
percentFormat
灞炴
鍙
public string getPercentFormat()
鐧惧垎姣旀牸寮
pluralRules
灞炴
鍙
public array getPluralRules()
澶嶆暟褰㈠紡琛ㄨ揪寮
scientificFormat
灞炴
鍙
public string getScientificFormat()
绉戝璁版暟娉曟牸寮
timeFormat
灞炴
鍙
public string getTimeFormat(string $width='medium')
鏃ユ湡鏍煎紡
weekDayNames
灞炴
鍙
public array getWeekDayNames(string $width='wide', boolean $standAlone=false)
杩斿洖鎸囧畾瀹藉害鐨勬槦鏈熷悕瀛椼
鏂规硶璇︾粏
__construct()
鏂规硶
|
protected void __construct(string $id)
| ||
| $id | string | 鍖哄煙ID锛堜緥濡傦細en_US锛 |
婧愮爜锛 framework/i18n/CLocale.php#97 (鏄剧ず)
protected function __construct($id)
{
$this->_id=self::getCanonicalID($id);
$dataPath=self::$dataPath===null ? dirname(__FILE__).DIRECTORY_SEPARATOR.'data' : self::$dataPath;
$dataFile=$dataPath.DIRECTORY_SEPARATOR.$this->_id.'.php';
if(is_file($dataFile))
$this->_data=require($dataFile);
else
throw new CException(Yii::t('yii','Unrecognized locale "{locale}".',array('{locale}'=>$id)));
}
鏋勯犲嚱鏁般 鐢变簬鏋勯犳柟娉曞彈淇濇姢锛 璇蜂娇鐢getInstance鏉ヨ幏寰楁寚瀹氬尯鍩熺殑瀹炰緥銆
getAMName()
鏂规硶
|
public string getAMName()
| ||
| {return} | string | AM鍚嶇О |
婧愮爜锛 framework/i18n/CLocale.php#266 (鏄剧ず)
public function getAMName()
{
return $this->_data['amName'];
}
getCanonicalID()
鏂规硶
|
public static string getCanonicalID(string $id)
| ||
| $id | string | 瑕佽浆绉荤殑鍖哄煙ID |
| {return} | string | 杩斿洖鍖哄煙ID鐨勫吀鍨嬫牸寮 |
婧愮爜锛 framework/i18n/CLocale.php#114 (鏄剧ず)
public static function getCanonicalID($id)
{
return strtolower(str_replace('-','_',$id));
}
杞崲鍖哄煙ID涓哄吀鍨嬫牸寮忋 鍦ㄥ吀鍨嬫牸寮忎腑锛屽尯鍩烮D鍙兘鐢卞皬鍐欏瓧姣嶅拰涓嬪垝绾跨粍鎴愩
getCurrencyFormat()
鏂规硶
|
public string getCurrencyFormat()
| ||
| {return} | string | 璐у竵鏍煎紡 |
婧愮爜锛 framework/i18n/CLocale.php#176 (鏄剧ず)
public function getCurrencyFormat()
{
return $this->_data['currencyFormat'];
}
getCurrencySymbol()
鏂规硶
|
public string getCurrencySymbol(string $currency)
| ||
| $currency | string | 3涓瓧姣嶇殑ISO4217鐮併傛瘮濡傦細鈥淯SD鈥濅唬琛ㄧ編鍏冿紝鈥淓UR鈥濅唬琛ㄦ鍏冦 |
| {return} | string | 璇ュ尯鍩熺殑璐у竵绗﹀彿锛屽鏋滅鍙蜂笉瀛樺湪鍒欒繑鍥瀗ull銆 |
婧愮爜锛 framework/i18n/CLocale.php#151 (鏄剧ず)
public function getCurrencySymbol($currency)
{
return isset($this->_data['currencySymbols'][$currency]) ? $this->_data['currencySymbols'][$currency] : null;
}
getDateFormat()
鏂规硶
|
public string getDateFormat(string $width='medium')
| ||
| $width | string | 鏃ユ湡鏍煎紡瀹藉害銆傚彲浠ユ槸鈥榝ull鈥欙紝鈥榣ong鈥欙紝鈥榤edium鈥欐垨鈥榮hort鈥欍 |
| {return} | string | 鏃ユ湡鏍煎紡 |
婧愮爜锛 framework/i18n/CLocale.php#283 (鏄剧ず)
public function getDateFormat($width='medium')
{
return $this->_data['dateFormats'][$width];
}
getDateFormatter()
鏂规硶
|
public CDateFormatter getDateFormatter()
| ||
| {return} | CDateFormatter | 杩斿洖杩欎釜鍖哄煙鐨勬棩鏈熸牸寮 |
婧愮爜锛 framework/i18n/CLocale.php#140 (鏄剧ず)
public function getDateFormatter()
{
if($this->_dateFormatter===null)
$this->_dateFormatter=new CDateFormatter($this);
return $this->_dateFormatter;
}
getDateTimeFormat()
鏂规硶
|
public string getDateTimeFormat()
| ||
| {return} | string | 鏃ユ湡鏃堕棿鏍煎紡锛屾瘮濡傦細鏃ユ湡鍜屾椂闂寸殑椤哄簭銆 |
婧愮爜锛 framework/i18n/CLocale.php#300 (鏄剧ず)
public function getDateTimeFormat()
{
return $this->_data['dateTimeFormat'];
}
getDecimalFormat()
鏂规硶
|
public string getDecimalFormat()
| ||
| {return} | string | 鍗佽繘鍒舵牸寮 |
婧愮爜锛 framework/i18n/CLocale.php#168 (鏄剧ず)
public function getDecimalFormat()
{
return $this->_data['decimalFormat'];
}
getEraName()
鏂规硶
|
public string getEraName(integer $era, string $width='wide')
| ||
| $era | integer | 骞翠唬锛0锛1锛 |
| $width | string | 骞翠唬鍚嶇О瀹藉害銆傚畠鍙互鏄榳ide鈥欙紝鈥榓bbreviated鈥欐垨鈥榥arrow鈥欍 |
| {return} | string | 骞翠唬鍚嶇О |
婧愮爜锛 framework/i18n/CLocale.php#258 (鏄剧ず)
public function getEraName($era,$width='wide')
{
return $this->_data['eraNames'][$width][$era];
}
getId()
鏂规硶
|
public string getId()
| ||
| {return} | string | 鍖哄煙ID锛堝吀鍨嬫牸寮忥級 |
getInstance()
鏂规硶
|
public static CLocale getInstance(string $id)
| ||
| $id | string | 鍖哄煙ID锛堜緥濡傦細en_US锛 |
| {return} | CLocale | 杩斿洖鍖哄煙瀹炰緥 |
婧愮爜锛 framework/i18n/CLocale.php#59 (鏄剧ず)
public static function getInstance($id)
{
static $locales=array();
if(isset($locales[$id]))
return $locales[$id];
else
return $locales[$id]=new CLocale($id);
}
杩斿洖鎸囧畾鍖哄煙瀹炰緥銆 鐢变簬CLocale鐨勬瀯閫犳柟娉曟槸鍙椾繚鎶ょ殑锛 浣犲彧鍙互浣跨敤杩欎釜鏂规硶鏉ュ彇寰楁寚瀹氬尯鍩熺殑瀹炰緥銆
getLanguage()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getLanguage(string $id)
| ||
| $id | string | Unicode璇█鏍囪瘑绗ETF BCP 47銆 渚嬪锛氫唬鐮佲渆n_US鈥濊嫳璇紙缇庡浗锛夊拰鈥渆n_GB鈥濅唬琛ㄨ嫳璇紙鑻卞浗锛夈 |
| {return} | string | 鏄剧ず鏈湴鍖栬瑷鍚嶇О锛屽鏋滀笉瀛樺湪杩斿洖null銆 |
婧愮爜锛 framework/i18n/CLocale.php#442 (鏄剧ず)
public function getLanguage($id)
{
return $this->getLocaleDisplayName($id, 'languages');
}
getLanguageID()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getLanguageID(string $id)
| ||
| $id | string | 瑕佽浆鎹㈢殑鍖哄煙ID |
| {return} | string | 璇█ID |
婧愮爜锛 framework/i18n/CLocale.php#329 (鏄剧ず)
public function getLanguageID($id)
{
// normalize id
$id = $this->getCanonicalID($id);
// remove sub tags
if(($underscorePosition=strpos($id, '_'))!== false)
{
$id = substr($id, 0, $underscorePosition);
}
return $id;
}
杞崲鍖哄煙ID涓鸿瑷ID銆 璇█ID涓轰笅鍒掔嚎鍓嶇殑涓缁勫瓧姣嶃
getLocaleDisplayName()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getLocaleDisplayName(string $id=NULL, string $category='languages')
| ||
| $id | string | array key from an array named by $category銆 |
| $category | string | 鏁版嵁绫诲埆銆傚崟涓鐨勨榣anguages鈥欙紝鈥榮cripts鈥欐垨鈥榯erritories鈥欍 |
| {return} | string | 杩斿洖鎸囧畾鐨勬湰鍦板寲鍚嶇О锛屽鏋滀笉瀛樺湪鍒欒繑鍥瀗ull銆 |
婧愮爜锛 framework/i18n/CLocale.php#413 (鏄剧ず)
public function getLocaleDisplayName($id=null, $category='languages')
{
$id = $this->getCanonicalID($id);
if (isset($this->_data[$category][$id]))
{
return $this->_data[$category][$id];
}
else if (($category == 'languages') && ($id=$this->getLanguageID($id)) && (isset($this->_data[$category][$id])))
{
return $this->_data[$category][$id];
}
else if (($category == 'scripts') && ($id=$this->getScriptID($id)) && (isset($this->_data[$category][$id])))
{
return $this->_data[$category][$id];
}
else if (($category == 'territories') && ($id=$this->getTerritoryID($id)) && (isset($this->_data[$category][$id])))
{
return $this->_data[$category][$id];
}
else {
return null;
}
}
鑾峰彇鏈湴鍖杋18鏁版嵁鏂囦欢鍦紙framework/i18n/data/ files)銆
getLocaleIDs()
鏂规硶
|
public static array getLocaleIDs()
| ||
| {return} | array | 妗嗘灦鍙互璇嗗埆鐨勫尯鍩烮D銆 |
婧愮爜锛 framework/i18n/CLocale.php#71 (鏄剧ず)
public static function getLocaleIDs()
{
static $locales;
if($locales===null)
{
$locales=array();
$dataPath=self::$dataPath===null ? dirname(__FILE__).DIRECTORY_SEPARATOR.'data' : self::$dataPath;
$folder=@opendir($dataPath);
while(($file=@readdir($folder))!==false)
{
$fullPath=$dataPath.DIRECTORY_SEPARATOR.$file;
if(substr($file,-4)==='.php' && is_file($fullPath))
$locales[]=substr($file,0,-4);
}
closedir($folder);
sort($locales);
}
return $locales;
}
getMonthName()
鏂规硶
|
public string getMonthName(integer $month, string $width='wide', boolean $standAlone=false)
| ||
| $month | integer | 鏈堜唤锛1-12锛 |
| $width | string | 鏈堜唤鍚嶇О瀹藉害锛屽畠鍙互鏄榳ide鈥欙紝鈥榓bbreviated鈥欐垨鈥榥arrow鈥欍 |
| $standAlone | boolean | 鏄惁杩斿洖鐙珛鏍煎紡鐨勬湀浠藉悕绉 |
| {return} | string | 鏈堜唤鍚嶇О |
婧愮爜锛 framework/i18n/CLocale.php#203 (鏄剧ず)
public function getMonthName($month,$width='wide',$standAlone=false)
{
if($standAlone)
return isset($this->_data['monthNamesSA'][$width][$month]) ? $this->_data['monthNamesSA'][$width][$month] : $this->_data['monthNames'][$width][$month];
else
return isset($this->_data['monthNames'][$width][$month]) ? $this->_data['monthNames'][$width][$month] : $this->_data['monthNamesSA'][$width][$month];
}
getMonthNames()
鏂规硶
|
public array getMonthNames(string $width='wide', boolean $standAlone=false)
| ||
| $width | string | 鏈堜唤鍚嶇О瀹藉害锛屽畠鍙互鏄榳ide鈥欙紝鈥榓bbreviated鈥欐垨鈥榥arrow鈥欍 |
| $standAlone | boolean | 鏄惁杩斿洖鐙珛鏍煎紡鐨勬湀浠藉悕绉 |
| {return} | array | 杩斿洖鐢憋紙1-12锛夌储寮曠殑鏈堜唤鍚嶇О |
婧愮爜锛 framework/i18n/CLocale.php#217 (鏄剧ず)
public function getMonthNames($width='wide',$standAlone=false)
{
if($standAlone)
return isset($this->_data['monthNamesSA'][$width]) ? $this->_data['monthNamesSA'][$width] : $this->_data['monthNames'][$width];
else
return isset($this->_data['monthNames'][$width]) ? $this->_data['monthNames'][$width] : $this->_data['monthNamesSA'][$width];
}
杩斿洖鎸囧畾瀹藉害鐨勬湀浠藉悕绉般
getNumberFormatter()
鏂规硶
|
public CNumberFormatter getNumberFormatter()
| ||
| {return} | CNumberFormatter | 杩斿洖杩欎釜鍖哄煙鐨勬暟瀛楁牸寮 |
婧愮爜锛 framework/i18n/CLocale.php#130 (鏄剧ず)
public function getNumberFormatter()
{
if($this->_numberFormatter===null)
$this->_numberFormatter=new CNumberFormatter($this);
return $this->_numberFormatter;
}
getNumberSymbol()
鏂规硶
|
public string getNumberSymbol(string $name)
| ||
| $name | string | 绗﹀彿鍚嶇О |
| {return} | string | 绗﹀彿 |
婧愮爜锛 framework/i18n/CLocale.php#160 (鏄剧ず)
public function getNumberSymbol($name)
{
return isset($this->_data['numberSymbols'][$name]) ? $this->_data['numberSymbols'][$name] : null;
}
getOrientation()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.2锛
|
public string getOrientation()
| ||
| {return} | string | 鏂囧瓧鏂瑰悜锛岃涔堟槸鈥榣tr鈥欙紙浠庡乏鍒板彸锛夛紝瑕佷箞鏄榬tl鈥欙紙浠庡彸鍒板乏锛夈 |
婧愮爜锛 framework/i18n/CLocale.php#309 (鏄剧ず)
public function getOrientation()
{
return isset($this->_data['orientation']) ? $this->_data['orientation'] : 'ltr';
}
getPMName()
鏂规硶
|
public string getPMName()
| ||
| {return} | string | PM鍚嶇О |
婧愮爜锛 framework/i18n/CLocale.php#274 (鏄剧ず)
public function getPMName()
{
return $this->_data['pmName'];
}
getPercentFormat()
鏂规硶
|
public string getPercentFormat()
| ||
| {return} | string | 鐧惧垎姣旀牸寮 |
婧愮爜锛 framework/i18n/CLocale.php#184 (鏄剧ず)
public function getPercentFormat()
{
return $this->_data['percentFormat'];
}
getPluralRules()
鏂规硶
|
public array getPluralRules()
| ||
| {return} | array | 澶嶆暟褰㈠紡琛ㄨ揪寮 |
婧愮爜锛 framework/i18n/CLocale.php#317 (鏄剧ず)
public function getPluralRules()
{
return isset($this->_data['pluralRules']) ? $this->_data['pluralRules'] : array();
}
getScientificFormat()
鏂规硶
|
public string getScientificFormat()
| ||
| {return} | string | 绉戝璁版暟娉曟牸寮 |
婧愮爜锛 framework/i18n/CLocale.php#192 (鏄剧ず)
public function getScientificFormat()
{
return $this->_data['scientificFormat'];
}
getScript()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getScript(string $id)
| ||
| $id | string | Unicode鑴氭湰鏍囪瘑绗ETF BCP 47銆 渚嬪锛氫唬鐮佲渆n_US鈥濊嫳璇紙缇庡浗锛夊拰鈥渆n_GB鈥濅唬琛ㄨ嫳璇紙鑻卞浗锛夈 |
| {return} | string | 鏄剧ず鏈湴鍖栬剼鏈悕绉帮紝濡傛灉涓嶅瓨鍦ㄨ繑鍥瀗ull銆 |
婧愮爜锛 framework/i18n/CLocale.php#452 (鏄剧ず)
public function getScript($id)
{
return $this->getLocaleDisplayName($id, 'scripts');
}
getScriptID()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getScriptID(string $id)
| ||
| $id | string | 瑕佽浆鎹㈢殑鍖哄煙ID |
| {return} | string | 鑴氭湰ID |
婧愮爜锛 framework/i18n/CLocale.php#348 (鏄剧ず)
public function getScriptID($id)
{
// normalize id
$id = $this->getCanonicalID($id);
// find sub tags
if(($underscorePosition=strpos($id, '_'))!==false)
{
$subTag = explode('_', $id);
// script sub tags can be distigused from territory sub tags by length
if (strlen($subTag[1])===4)
{
$id = $subTag[1];
}
else
{
$id = null;
}
}
else
{
$id = null;
}
return $id;
}
杞崲鍖哄煙ID涓鸿剼鏈琁D銆 鑴氭湰ID涓轰笅鍒掔嚎鍚庡洓浣嶅瓧绗︾粍鎴愩
getTerritory()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getTerritory(string $id)
| ||
| $id | string | Unicode鑼冨洿鏍囪瘑绗ETF BCP 47銆 渚嬪锛氫唬鐮佲渆n_US鈥濊嫳璇紙缇庡浗锛夊拰鈥渆n_GB鈥濅唬琛ㄨ嫳璇紙鑻卞浗锛夈 |
| {return} | string | 鏄剧ず鑼冨洿鍚嶇О锛屽鏋滀笉瀛樺湪杩斿洖null銆 |
婧愮爜锛 framework/i18n/CLocale.php#462 (鏄剧ず)
public function getTerritory($id)
{
return $this->getLocaleDisplayName($id, 'territories');
}
getTerritoryID()
鏂规硶
锛堝彲鐢ㄨ嚜 v1.1.9锛
|
public string getTerritoryID(string $id)
| ||
| $id | string | 瑕佽浆鎹㈢殑鍖哄煙ID |
| {return} | string | 鑼冨洿ID |
婧愮爜锛 framework/i18n/CLocale.php#380 (鏄剧ず)
public function getTerritoryID($id)
{
// normalize id
$id = $this->getCanonicalID($id);
// find sub tags
if (($underscorePosition=strpos($id, '_'))!== false)
{
$subTag = explode('_', $id);
// territory sub tags can be distigused from script sub tags by length
if (strlen($subTag[1])<4)
{
$id = $subTag[1];
}
else
{
$id = null;
}
}
else
{
$id = null;
}
return $id;
}
杞崲鍖哄煙ID涓鸿寖鍥碔D銆 鑼冨洿ID鐢变笅鍒掔嚎鍚2鑷3浣嶅瓧姣嶅拰鏁板瓧缁勬垚銆
getTimeFormat()
鏂规硶
|
public string getTimeFormat(string $width='medium')
| ||
| $width | string | 鏃堕棿鏍煎紡瀹藉害銆傚彲浠ユ槸鈥榝ull鈥欙紝鈥榣ong鈥欙紝鈥榤edium鈥欐垨鈥榮hort鈥欍 |
| {return} | string | 鏃ユ湡鏍煎紡 |
婧愮爜锛 framework/i18n/CLocale.php#292 (鏄剧ず)
public function getTimeFormat($width='medium')
{
return $this->_data['timeFormats'][$width];
}
getWeekDayName()
鏂规硶
|
public string getWeekDayName(integer $day, string $width='wide', boolean $standAlone=false)
| ||
| $day | integer | 鏄熸湡锛0-6锛0鎰忓懗鐫鏄熸湡澶╋級 |
| $width | string | 鏄熸湡鍚嶇О瀹藉害銆傚畠鍙互鏄榳ide鈥欙紝鈥榓bbreviated鈥欐垨鈥榥arrow鈥欍 |
| $standAlone | boolean | 鏄惁杩斿洖鐙珛鏍煎紡鐨勬槦鏈熷悕绉 |
| {return} | string | 鏄熸湡鍚嶇О |
婧愮爜锛 framework/i18n/CLocale.php#231 (鏄剧ず)
public function getWeekDayName($day,$width='wide',$standAlone=false)
{
if($standAlone)
return isset($this->_data['weekDayNamesSA'][$width][$day]) ? $this->_data['weekDayNamesSA'][$width][$day] : $this->_data['weekDayNames'][$width][$day];
else
return isset($this->_data['weekDayNames'][$width][$day]) ? $this->_data['weekDayNames'][$width][$day] : $this->_data['weekDayNamesSA'][$width][$day];
}
getWeekDayNames()
鏂规硶
|
public array getWeekDayNames(string $width='wide', boolean $standAlone=false)
| ||
| $width | string | 鏄熸湡鍚嶇О瀹藉害銆傚畠鍙互鏄榳ide鈥欙紝鈥榓bbreviated鈥欐垨鈥榥arrow鈥欍 |
| $standAlone | boolean | 鏄惁杩斿洖鐙珛鏍煎紡鐨勬槦鏈熷悕绉 |
| {return} | array | 鐢辨槦鏈熷肩储寮 锛0-6锛0鏄槦鏈熷ぉ锛1鏄槦鏈熶竴锛 ...锛夌殑鏄熸湡鍚嶅瓧銆 |
婧愮爜锛 framework/i18n/CLocale.php#245 (鏄剧ず)
public function getWeekDayNames($width='wide',$standAlone=false)
{
if($standAlone)
return isset($this->_data['weekDayNamesSA'][$width]) ? $this->_data['weekDayNamesSA'][$width] : $this->_data['weekDayNames'][$width];
else
return isset($this->_data['weekDayNames'][$width]) ? $this->_data['weekDayNames'][$width] : $this->_data['weekDayNamesSA'][$width];
}
杩斿洖鎸囧畾瀹藉害鐨勬槦鏈熷悕瀛椼