LocalizationService

Type
Class
Namespace
Craft
Inherits
Craft\LocalizationService » Craft\BaseApplicationComponent » CApplicationComponent » CComponent
Implements
IApplicationComponent
Since
1.0

Class LocalizationService

See also http://craftcms.com

View source

Public Properties

PropertyDescription
$behaviorsarray – The behaviors that should be attached to this component.

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.
addSiteLocale()Adds a new site locale.
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.
deleteSiteLocale()Deletes a site locale.
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.
getAllLocales()Returns an array of all known locales. The list of known locales is based on whatever files exist in framework/i18n/data/.
getAppLocaleIds()Returns an array of the locale IDs which Craft has been translated into. The list of locales is based on whatever files exist in craft/app/translations/.
getAppLocales()Returns an array of locales that Craft is translated into. The list of locales is based on whatever files exist in craft/app/translations/.
getEditableLocaleIds()Returns an array of the editable locale IDs.
getEditableLocales()Returns a list of locales that are editable by the current user.
getEventHandlers()Returns the list of attached event handlers for an event.
getIsInitialized()Checks if this application component has been initialized.
getLocaleById()Returns a locale by its ID.
getLocaleData()Returns the localization data for a given locale.
getPrimarySiteLocale()Returns the site's primary locale. The primary locale is whatever is listed first in Settings > Locales in the control panel.
getPrimarySiteLocaleId()Returns the site's primary locale ID. The primary locale is whatever is listed first in Settings > Locales in the control panel.
getSiteLocaleIds()Returns an array of the site locale IDs. The list of locales is based on whatever was defined in Settings > Locales in the control panel.
getSiteLocales()Returns an array of the site locales. The list of locales is based on whatever was defined in Settings > Locales in the control panel.
hasEvent()Determines whether an event is defined.
hasEventHandler()Checks whether the named event has attached handlers.
hasProperty()Determines whether a property is defined.
init()Initializes the application component.
isInitialized()Checks if this application component has been initialized yet, or not.
onAddLocale()Fires an 'onAddLocale' event.
onBeforeDeleteLocale()Fires an 'onBeforeDeleteLocale' event.
onDeleteLocale()Fires an 'onDeleteLocale' event.
raiseEvent()Raises an event.
reorderSiteLocales()Reorders the site's locales.

addSiteLocale()

Adds a new site locale.

View source

Arguments

Returns

boolean

Signature

public boolean addSiteLocale ( $localeId )

deleteSiteLocale()

Deletes a site locale.

View source

Arguments

  • $localeId (string) – The locale to be deleted.
  • $transferContentTo (string, null) – The locale that should take over the deleted locale’s content.

Returns

boolean – Whether the locale was successfully deleted.

Throws

Signature

public boolean deleteSiteLocale ( $localeId, $transferContentTo )

getAllLocales()

Returns an array of all known locales. The list of known locales is based on whatever files exist in framework/i18n/data/.

View source

Returns

array – An array of LocaleModel objects.

Signature

public array getAllLocales ( )

getAppLocaleIds()

Returns an array of the locale IDs which Craft has been translated into. The list of locales is based on whatever files exist in craft/app/translations/.

View source

Returns

array – An array of locale IDs.

Signature

public array getAppLocaleIds ( )

getAppLocales()

Returns an array of locales that Craft is translated into. The list of locales is based on whatever files exist in craft/app/translations/.

View source

Returns

array – An array of {@link LocaleModel} objects.

Signature

public array getAppLocales ( )

getEditableLocaleIds()

Returns an array of the editable locale IDs.

View source

Returns

array

Signature

public array getEditableLocaleIds ( )

getEditableLocales()

Returns a list of locales that are editable by the current user.

View source

Returns

array

Signature

public array getEditableLocales ( )

getLocaleById()

Returns a locale by its ID.

View source

Arguments

Returns

Craft\LocaleModel

Signature

public Craft\LocaleModel getLocaleById ( $localeId )

getLocaleData()

Returns the localization data for a given locale.

View source

Arguments

Returns

Craft\LocaleData, null

Signature

public Craft\LocaleData, null getLocaleData ( $localeId = null )

getPrimarySiteLocale()

Returns the site's primary locale. The primary locale is whatever is listed first in Settings > Locales in the control panel.

View source

Returns

Craft\LocaleModel – A {@link LocaleModel} object representing the primary locale.

Signature

public Craft\LocaleModel getPrimarySiteLocale ( )

getPrimarySiteLocaleId()

Returns the site's primary locale ID. The primary locale is whatever is listed first in Settings > Locales in the control panel.

View source

Returns

string – The primary locale ID.

Signature

public string getPrimarySiteLocaleId ( )

getSiteLocaleIds()

Returns an array of the site locale IDs. The list of locales is based on whatever was defined in Settings > Locales in the control panel.

View source

Returns

array – An array of locale IDs.

Signature

public array getSiteLocaleIds ( )

getSiteLocales()

Returns an array of the site locales. The list of locales is based on whatever was defined in Settings > Locales in the control panel.

View source

Returns

array – An array of {@link LocaleModel} objects.

Signature

public array getSiteLocales ( )

onAddLocale()

Fires an 'onAddLocale' event.

View source

Arguments

Returns

null

Signature

public null onAddLocale ( Craft\Event $event )

onBeforeDeleteLocale()

Fires an 'onBeforeDeleteLocale' event.

View source

Arguments

Returns

null

Signature

public null onBeforeDeleteLocale ( Craft\Event $event )

onDeleteLocale()

Fires an 'onDeleteLocale' event.

View source

Arguments

Returns

null

Signature

public null onDeleteLocale ( Craft\Event $event )

reorderSiteLocales()

Reorders the site's locales.

View source

Arguments

Returns

boolean

Signature

public boolean reorderSiteLocales ( $localeIds )