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

  • CDateTimeParser
  • CFileHelper
  • CFormatter
  • CLocalizedFormatter
  • CMarkdownParser
  • CPasswordHelper
  • CPropertyValue
  • CTimestamp
  • CVarDumper
  • Overview
  • Package
  • Class
  • Tree

Class CLocalizedFormatter

CLocalizedFormatter provides a set of commonly used data formatting methods based on the current locale settings.

It provides the same functionality as CFormatter, but overrides all the settings for CFormatter::$booleanFormat, CFormatter::$datetimeFormat and CFormatter::$numberFormat with the values for the current locale. Because of this you are not able to configure these properties for CLocalizedFormatter directly. Date and time format can be adjusted by setting CLocalizedFormatter::$dateFormat and CLocalizedFormatter::$timeFormat.

It uses CApplication::locale by default but you can set a custom locale by using CLocalizedFormatter::setLocale()-method.

For a list of recognizable format types, and details on how to call the formatter methods, see CFormatter documentation.

To replace the application component 'format', which is registered by CApplication by default, you can put this in your application 'components' config:

'format' => array(
    'class' => 'CLocalizedFormatter',
),
CComponent
Extended by CApplicationComponent implements IApplicationComponent
Extended by CFormatter
Extended by CLocalizedFormatter
Package: system\utils
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Carsten Brandt <mail@cebe.cc>
Since: 1.1.14
Located at x2engine/framework/utils/CLocalizedFormatter.php
Methods summary
public
# setLocale( CLocale|string $locale )

Set the locale to use for formatting values.

Set the locale to use for formatting values.

Parameters

$locale
CLocale|string
$locale an instance of CLocale or a locale ID
public CLocale
# getLocale( )

Returns

CLocale
$locale the locale currently used for formatting values
public string
# formatBoolean( mixed $value )

Formats the value as a boolean.

Formats the value as a boolean.

Parameters

$value
mixed
$value the value to be formatted

Returns

string
the formatted result

See

CFormatter::$booleanFormat

Overrides

CFormatter::formatBoolean()
public string
# formatDate( mixed $value )

Formats the value as a date using the locales date formatter.

Formats the value as a date using the locales date formatter.

Parameters

$value
mixed
$value the value to be formatted

Returns

string
the formatted result

See

CLocalizedFormatter::$dateFormat
CLocale::getDateFormatter()

Overrides

CFormatter::formatDate()
public string
# formatTime( mixed $value )

Formats the value as a time using the locales date formatter.

Formats the value as a time using the locales date formatter.

Parameters

$value
mixed
$value the value to be formatted

Returns

string
the formatted result

See

CLocalizedFormatter::$timeFormat
CLocale::getDateFormatter()

Overrides

CFormatter::formatTime()
public string
# formatDatetime( mixed $value )

Formats the value as a date and time using the locales date formatter.

Formats the value as a date and time using the locales date formatter.

Parameters

$value
mixed
$value the value to be formatted

Returns

string
the formatted result

See

CLocalizedFormatter::$dateFormat
CLocalizedFormatter::$timeFormat
CLocale::getDateFormatter()

Overrides

CFormatter::formatDatetime()
public string
# formatNumber( mixed $value )

Formats the value as a number using the locales number formatter.

Formats the value as a number using the locales number formatter.

Parameters

$value
mixed
$value the value to be formatted

Returns

string
the formatted result

See

CLocale::getNumberFormatter()

Overrides

CFormatter::formatNumber()
Methods inherited from CFormatter
__call(), format(), formatEmail(), formatHtml(), formatImage(), formatNtext(), formatRaw(), formatSize(), formatText(), formatUrl(), getHtmlPurifier(), normalizeDateValue()
Methods inherited from CApplicationComponent
getIsInitialized(), init()
Methods inherited from CComponent
__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 string $dateFormat 'medium'
#

the width of the date pattern. It can be 'full', 'long', 'medium' and 'short'. Defaults to 'medium'.

the width of the date pattern. It can be 'full', 'long', 'medium' and 'short'. Defaults to 'medium'.

See

CDateFormatter::formatDateTime()
public string $timeFormat 'medium'
#

the width of the time pattern. It can be 'full', 'long', 'medium' and 'short'. Defaults to 'medium'.

the width of the time pattern. It can be 'full', 'long', 'medium' and 'short'. Defaults to 'medium'.

See

CDateFormatter::formatDateTime()
Properties inherited from CFormatter
$booleanFormat, $datetimeFormat, $htmlPurifierOptions, $numberFormat, $sizeFormat
Properties inherited from CApplicationComponent
$behaviors
Magic properties inherited from CFormatter
$htmlPurifier
Magic properties inherited from CApplicationComponent
$isInitialized
API documentation generated by ApiGen 2.8.0