system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.i18n system.i18n.gettext system.logging system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers

CLocale

system.i18n
继承 class CLocale » CComponent
可用自 1.0
版本 $Id$
CLocale represents the data relevant to a locale.

The data includes the number formatting information and date formatting information.

公共属性

隐藏继承的属性

属性类型描述被定义在
aMName string the AM name CLocale
currencyFormat string the currency format CLocale
dateFormat string date format CLocale
dateFormatter CDateFormatter the date formatter for this locale CLocale
dateTimeFormat string datetime format, i. CLocale
decimalFormat string the decimal format CLocale
id string the locale ID (in canonical form) CLocale
monthNames array Returns the month names in the specified width. CLocale
numberFormatter CNumberFormatter the number formatter for this locale CLocale
pMName string the PM name CLocale
percentFormat string the percent format CLocale
scientificFormat string the scientific format CLocale
timeFormat string date format CLocale
weekDayNames array Returns the week day names in the specified width. CLocale

公共方法

隐藏继承的方法

方法描述被定义在
__call() Calls the named method which is not a class method. CComponent
__get() Returns a property value, an event handler list or a behavior based on its name. CComponent
__isset() Checks if a property value is null. CComponent
__set() Sets value of a component property. CComponent
__unset() Sets a component property to be null. CComponent
asa() Returns the named behavior object. CComponent
attachBehavior() Attaches a behavior to this component. CComponent
attachBehaviors() Attaches a list of behaviors to the component. CComponent
attachEventHandler() Attaches an event handler to an event. CComponent
canGetProperty() Determines whether a property can be read. CComponent
canSetProperty() Determines whether a property can be set. CComponent
detachBehavior() Detaches a behavior from the component. CComponent
detachBehaviors() Detaches all behaviors from the component. CComponent
detachEventHandler() Detaches an existing event handler. CComponent
disableBehavior() Disables an attached behavior. CComponent
disableBehaviors() Disables all behaviors attached to this component. CComponent
enableBehavior() Enables an attached behavior. CComponent
enableBehaviors() Enables all behaviors attached to this component. CComponent
getAMName() CLocale
getCanonicalID() Converts a locale ID to its canonical form. CLocale
getCurrencyFormat() CLocale
getCurrencySymbol() CLocale
getDateFormat() CLocale
getDateFormatter() CLocale
getDateTimeFormat() CLocale
getDecimalFormat() CLocale
getEraName() CLocale
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
getId() CLocale
getInstance() Returns the instance of the specified locale. CLocale
getLocaleIDs() CLocale
getMonthName() CLocale
getMonthNames() Returns the month names in the specified width. CLocale
getNumberFormatter() CLocale
getNumberSymbol() CLocale
getPMName() CLocale
getPercentFormat() CLocale
getScientificFormat() CLocale
getTimeFormat() CLocale
getWeekDayName() CLocale
getWeekDayNames() Returns the week day names in the specified width. CLocale
hasEvent() Determines whether an event is defined. CComponent
hasEventHandler() Checks whether the named event has attached handlers. CComponent
hasProperty() Determines whether a property is defined. CComponent
raiseEvent() Raises an event. CComponent

受保护的方法

隐藏继承的方法

方法描述被定义在
__construct() Constructor. CLocale

属性详情

aMName 属性 只读
public string getAMName()

the AM name

currencyFormat 属性 只读
public string getCurrencyFormat()

the currency format

dateFormat 属性 只读
public string getDateFormat(string $width='medium')

date format

dateFormatter 属性 只读

the date formatter for this locale

dateTimeFormat 属性 只读
public string getDateTimeFormat()

datetime format, i.e., the order of date and time.

decimalFormat 属性 只读
public string getDecimalFormat()

the decimal format

id 属性 只读
public string getId()

the locale ID (in canonical form)

monthNames 属性 只读 (自版本 v1.0.9 可用)
public array getMonthNames(string $width='wide')

Returns the month names in the specified width.

numberFormatter 属性 只读

the number formatter for this locale

pMName 属性 只读
public string getPMName()

the PM name

percentFormat 属性 只读
public string getPercentFormat()

the percent format

scientificFormat 属性 只读
public string getScientificFormat()

the scientific format

timeFormat 属性 只读
public string getTimeFormat(string $width='medium')

date format

weekDayNames 属性 只读 (自版本 v1.0.9 可用)
public array getWeekDayNames(string $width='wide')

Returns the week day names in the specified width.

方法详情

__construct() 方法
protected void __construct(string $id)
$id string the locale ID (e.g. en_US)

Constructor. Since the constructor is protected, please use getInstance to obtain an instance of the specified locale.

getAMName() 方法
public string getAMName()
{return} string the AM name

getCanonicalID() 方法
public static string getCanonicalID(string $id)
$id string the locale ID to be converted
{return} string the locale ID in canonical form

Converts a locale ID to its canonical form. In canonical form, a locale ID consists of only underscores and lower-case letters.

getCurrencyFormat() 方法
public string getCurrencyFormat()
{return} string the currency format

getCurrencySymbol() 方法
public string getCurrencySymbol(string $currency)
$currency string 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
{return} string the localized currency symbol. Null if the symbol does not exist.

getDateFormat() 方法
public string getDateFormat(string $width='medium')
$width string date format width. It can be 'full', 'long', 'medium' or 'short'.
{return} string date format

getDateFormatter() 方法
public CDateFormatter getDateFormatter()
{return} CDateFormatter the date formatter for this locale

getDateTimeFormat() 方法
public string getDateTimeFormat()
{return} string datetime format, i.e., the order of date and time.

getDecimalFormat() 方法
public string getDecimalFormat()
{return} string the decimal format

getEraName() 方法
public string getEraName(integer $era, string $width='wide')
$era integer era (0,1)
$width string era name width. It can be 'wide', 'abbreviated' or 'narrow'.
{return} string the era name

getId() 方法
public string getId()
{return} string the locale ID (in canonical form)

getInstance() 方法
public static CLocale getInstance(string $id)
$id string the locale ID (e.g. en_US)
{return} CLocale the locale instance

Returns the instance of the specified locale. Since the constructor of CLocale is protected, you can only use this method to obtain an instance of the specified locale.

getLocaleIDs() 方法
public static array getLocaleIDs()
{return} array IDs of the locales which the framework can recognize

getMonthName() 方法
public string getMonthName(integer $month, string $width='wide')
$month integer month (1-12)
$width string month name width. It can be 'wide', 'abbreviated' or 'narrow'.
{return} string the month name

getMonthNames() 方法 (自版本 v1.0.9 可用)
public array getMonthNames(string $width='wide')
$width string month name width. It can be 'wide', 'abbreviated' or 'narrow'.
{return} array month names indexed by month values (1-12)

Returns the month names in the specified width.

getNumberFormatter() 方法
public CNumberFormatter getNumberFormatter()
{return} CNumberFormatter the number formatter for this locale

getNumberSymbol() 方法
public string getNumberSymbol(string $name)
$name string symbol name
{return} string symbol

getPMName() 方法
public string getPMName()
{return} string the PM name

getPercentFormat() 方法
public string getPercentFormat()
{return} string the percent format

getScientificFormat() 方法
public string getScientificFormat()
{return} string the scientific format

getTimeFormat() 方法
public string getTimeFormat(string $width='medium')
$width string time format width. It can be 'full', 'long', 'medium' or 'short'.
{return} string date format

getWeekDayName() 方法
public string getWeekDayName(integer $day, string $width='wide')
$day integer weekday (0-6, 0 means Sunday)
$width string weekday name width. It can be 'wide', 'abbreviated' or 'narrow'.
{return} string the weekday name

getWeekDayNames() 方法 (自版本 v1.0.9 可用)
public array getWeekDayNames(string $width='wide')
$width string weekday name width. It can be 'wide', 'abbreviated' or 'narrow'.
{return} array the weekday names indexed by weekday values (0-6, 0 means Sunday, 1 Monday, etc.)

Returns the week day names in the specified width.