Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CChoiceFormat
  • CDateFormatter
  • CDbMessageSource
  • CGettextMessageSource
  • CLocale
  • CMessageSource
  • CMissingTranslationEvent
  • CNumberFormatter
  • CPhpMessageSource
  • Overview
  • Package
  • Class
  • Tree

Class CLocale

CLocale represents the data relevant to a locale.

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

CComponent
Extended by CLocale
Package: system\i18n
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/i18n/CLocale.php
Methods summary
public static CLocale
# getInstance( string $id )

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.

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.

Parameters

$id
string
$id the locale ID (e.g. en_US)

Returns

CLocale
the locale instance
public static array
# getLocaleIDs( )

Returns

array
IDs of the locales which the framework can recognize
protected
# __construct( string $id )

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

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

Parameters

$id
string
$id the locale ID (e.g. en_US)

Throws

CException
if given locale id is not recognized
public static string
# getCanonicalID( string $id )

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

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

Parameters

$id
string
$id the locale ID to be converted

Returns

string
the locale ID in canonical form
public string
# getId( )

Returns

string
the locale ID (in canonical form)
public CNumberFormatter
# getNumberFormatter( )

Returns

CNumberFormatter
the number formatter for this locale
public CDateFormatter
# getDateFormatter( )

Returns

CDateFormatter
the date formatter for this locale
public string
# getCurrencySymbol( string $currency )

Parameters

$currency
string
$currency 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.

Returns

string
the localized currency symbol. Null if the symbol does not exist.
public string
# getNumberSymbol( string $name )

Parameters

$name
string
$name symbol name

Returns

string
symbol
public string
# getDecimalFormat( )

Returns

string
the decimal format
public string
# getCurrencyFormat( )

Returns

string
the currency format
public string
# getPercentFormat( )

Returns

string
the percent format
public string
# getScientificFormat( )

Returns

string
the scientific format
public string
# getMonthName( integer $month, string $width = 'wide', boolean $standAlone = false )

Parameters

$month
integer
$month month (1-12)
$width
string
$width month name width. It can be 'wide', 'abbreviated' or 'narrow'.
$standAlone
boolean
$standAlone whether the month name should be returned in stand-alone format

Returns

string
the month name
public array
# getMonthNames( string $width = 'wide', boolean $standAlone = false )

Returns the month names in the specified width.

Returns the month names in the specified width.

Parameters

$width
string
$width month name width. It can be 'wide', 'abbreviated' or 'narrow'.
$standAlone
boolean
$standAlone whether the month names should be returned in stand-alone format

Returns

array
month names indexed by month values (1-12)
public string
# getWeekDayName( integer $day, string $width = 'wide', boolean $standAlone = false )

Parameters

$day
integer
$day weekday (0-7, 0 and 7 means Sunday)
$width
string
$width weekday name width. It can be 'wide', 'abbreviated' or 'narrow'.
$standAlone
boolean
$standAlone whether the week day name should be returned in stand-alone format

Returns

string
the weekday name
public array
# getWeekDayNames( string $width = 'wide', boolean $standAlone = false )

Returns the week day names in the specified width.

Returns the week day names in the specified width.

Parameters

$width
string
$width weekday name width. It can be 'wide', 'abbreviated' or 'narrow'.
$standAlone
boolean
$standAlone whether the week day name should be returned in stand-alone format

Returns

array
the weekday names indexed by weekday values (0-6, 0 means Sunday, 1 Monday, etc.)
public string
# getEraName( integer $era, string $width = 'wide' )

Parameters

$era
integer
$era era (0,1)
$width
string
$width era name width. It can be 'wide', 'abbreviated' or 'narrow'.

Returns

string
the era name
public string
# getAMName( )

Returns

string
the AM name
public string
# getPMName( )

Returns

string
the PM name
public string
# getDateFormat( string $width = 'medium' )

Parameters

$width
string
$width date format width. It can be 'full', 'long', 'medium' or 'short'.

Returns

string
date format
public string
# getTimeFormat( string $width = 'medium' )

Parameters

$width
string
$width time format width. It can be 'full', 'long', 'medium' or 'short'.

Returns

string
date format
public string
# getDateTimeFormat( )

Returns

string
datetime format, i.e., the order of date and time.
public string
# getOrientation( )

Returns

string
the character orientation, which is either 'ltr' (left-to-right) or 'rtl' (right-to-left)

Since

1.1.2
public array
# getPluralRules( )

Returns

array
plural forms expressions
public string
# getLanguageID( string $id )

Converts a locale ID to a language ID. A language ID consists of only the first group of letters before an underscore or dash.

Converts a locale ID to a language ID. A language ID consists of only the first group of letters before an underscore or dash.

Parameters

$id
string
$id the locale ID to be converted

Returns

string
the language ID

Since

1.1.9
public string
# getScriptID( string $id )

Converts a locale ID to a script ID. A script ID consists of only the last four characters after an underscore or dash.

Converts a locale ID to a script ID. A script ID consists of only the last four characters after an underscore or dash.

Parameters

$id
string
$id the locale ID to be converted

Returns

string
the script ID

Since

1.1.9
public string
# getTerritoryID( string $id )

Converts a locale ID to a territory ID. A territory ID consists of only the last two to three letter or digits after an underscore or dash.

Converts a locale ID to a territory ID. A territory ID consists of only the last two to three letter or digits after an underscore or dash.

Parameters

$id
string
$id the locale ID to be converted

Returns

string
the territory ID

Since

1.1.9
public string
# getLocaleDisplayName( string $id = null, string $category = 'languages' )

Gets a localized name from i18n data file (one of framework/i18n/data/ files).

Gets a localized name from i18n data file (one of framework/i18n/data/ files).

Parameters

$id
string
$id array key from an array named by $category.
$category
string
$category data category. One of 'languages', 'scripts' or 'territories'.

Returns

string
the localized name for the id specified. Null if data does not exist.

Since

1.1.9
public string
# getLanguage( string $id )

Parameters

$id
string
$id Unicode language identifier from IETF BCP 47. For example, the code "en_US" represents U.S. English and "en_GB" represents British English.

Returns

string
the local display name for the language. Null if the language code does not exist.

Since

1.1.9
public string
# getScript( string $id )

Parameters

$id
string
$id Unicode script identifier from IETF BCP 47. For example, the code "en_US" represents U.S. English and "en_GB" represents British English.

Returns

string
the local display name for the script. Null if the script code does not exist.

Since

1.1.9
public string
# getTerritory( string $id )

Parameters

$id
string
$id Unicode territory identifier from IETF BCP 47. For example, the code "en_US" represents U.S. English and "en_GB" represents British English.

Returns

string
the local display name for the territory. Null if the territory code does not exist.

Since

1.1.9
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public static string $dataPath
#

the directory that contains the locale data. If this property is not set, the locale data will be loaded from 'framework/i18n/data'.

the directory that contains the locale data. If this property is not set, the locale data will be loaded from 'framework/i18n/data'.

Since

1.1.0
Magic properties summary
public string $id
#

The locale ID (in canonical form).

The locale ID (in canonical form).

public CNumberFormatter $numberFormatter
#

The number formatter for this locale.

The number formatter for this locale.

public CDateFormatter $dateFormatter
#

The date formatter for this locale.

The date formatter for this locale.

public string $decimalFormat
#

The decimal format.

The decimal format.

public string $currencyFormat
#

The currency format.

The currency format.

public string $percentFormat
#

The percent format.

The percent format.

public string $scientificFormat
#

The scientific format.

The scientific format.

public array $monthNames
#

Month names indexed by month values (1-12).

Month names indexed by month values (1-12).

public array $weekDayNames
#

The weekday names indexed by weekday values (0-6, 0 means Sunday, 1 Monday, etc.).

The weekday names indexed by weekday values (0-6, 0 means Sunday, 1 Monday, etc.).

public string $aMName
#

The AM name.

The AM name.

public string $pMName
#

The PM name.

The PM name.

public string $dateFormat
#

Date format.

Date format.

public string $timeFormat
#

Date format.

Date format.

public string $dateTimeFormat
#

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

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

public string $orientation
#

The character orientation, which is either 'ltr' (left-to-right) or 'rtl' (right-to-left).

The character orientation, which is either 'ltr' (left-to-right) or 'rtl' (right-to-left).

public array $pluralRules
#

Plural forms expressions.

Plural forms expressions.

API documentation generated by ApiGen 2.8.0