LocaleData

Type
Class
Namespace
Craft
Inherits
Craft\LocaleData » CLocale » CComponent
Since
1.0

Class LocaleData

See also http://craftcms.com

View source

Public Properties

PropertyDescription
$dataPathstring – The directory that contains the locale data.

Protected Properties

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__get()Returns a property value, an event handler list or a behavior based on its name.
__isset()Checks if a property value is null.
__set()Sets value of a component property.
__unset()Sets a component property to be null.
asa()Returns the named behavior object.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
attachEventHandler()Attaches an event handler to an event.
canGetProperty()Determines whether a property can be read.
canSetProperty()Determines whether a property can be set.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
detachEventHandler()Detaches an existing event handler.
disableBehavior()Disables an attached behavior.
disableBehaviors()Disables all behaviors attached to this component.
enableBehavior()Enables an attached behavior.
enableBehaviors()Enables all behaviors attached to this component.
evaluateExpression()Evaluates a PHP expression or callback under the context of this component.
exists()
getAMName()
getAllTerritories()Returns an array of territories for the locale instance or null, if none exist.
getCanonicalID()Converts a locale ID to its canonical form.
getCurrencyFormat()
getCurrencySymbol()
getDateFormat()
getDateFormatter()
getDateTimeFormat()
getDecimalFormat()
getEraName()
getEventHandlers()Returns the list of attached event handlers for an event.
getId()
getInstance()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.
getLanguage()Converts a locale ID to a language ID. Language ID consists of only the first group of letters before an underscore or dash.
getLanguageID()Converts a locale ID to a language ID.
getLocaleDisplayName()Gets a localized name from i18n data file (one of framework/i18n/data/ files).
getLocaleIDs()
getMonthName()
getMonthNames()Returns the month names in the specified width.
getNumberFormatter()
getNumberSymbol()
getOrientation()
getPMName()
getPercentFormat()
getPluralRules()
getScientificFormat()
getScript()
getScriptID()Converts a locale ID to a script ID.
getTerritory()
getTerritoryID()Converts a locale ID to a territory ID.
getTimeFormat()
getWeekDayName()
getWeekDayNames()Returns the week day names in the specified width.
hasEvent()Determines whether an event is defined.
hasEventHandler()Checks whether the named event has attached handlers.
hasProperty()Determines whether a property is defined.
raiseEvent()Raises an event.

exists()

View source

Arguments

  • $id

Returns

boolean

Signature

public static boolean exists ( $id )

getAllTerritories()

Returns an array of territories for the locale instance or null, if none exist.

View source

Returns

string[], null – An array of all territories for the given locale, or null, if none exist.

Signature

public string[], null getAllTerritories ( )

getDateFormatter()

Signature

public Craft\DateFormatter getDateFormatter ( )

getInstance()

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.

View source

Arguments

  • $id (string) – The locale ID (e.g. en_US)

Returns

Craft\LocaleData – The locale instance

Signature

public static Craft\LocaleData getInstance ( $id )

getLanguage()

Converts a locale ID to a language ID. Language ID consists of only the first group of letters before an underscore or dash. Craft overrides the parent method from {@link \CLocale} because this is where we want to chop off the territory half of a locale ID.

View source

Arguments

  • $id (string) – The locale ID to be converted

Returns

string – The language ID

Signature

public string getLanguage ( $id )

getNumberFormatter()

Signature

public Craft\NumberFormatter getNumberFormatter ( )

Protected Methods

MethodDescription
__construct()Constructor.