symfony API

sfCultureInfo Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfCultureInfo class.

Method Summary

  • array &($filename)
    Gets the data by unserializing the ICU data from disk.
  • array_add()
    Adds an array to an already existing array.
  • string dataDir()
    Gets the default directory for the ICU data.
  • string fileExt()
    Gets the filename extension for ICU data. Default is ".dat".
  • mixed findInfo($path, $merge)
    Finds the specific ICU data information from the data.
  • string getCalendar()
    Gets the default calendar used by the culture, e.g. "gregorian".
  • array getCountries($countries)
    Gets a list of countries in the language of the localized version.
  • string getCountry($code)
    Get the country name in the current culture for the given code.
  • array getCultures($type)
    Gets the list of supported cultures filtered by the specified
  • array getCurrencies($currencies, $full)
    Gets a list of currencies in the language of the localized version.
  • string getCurrency($code)
    Get the currency name in the current culture for the given code.
  • sfDateTimeFormatInfo getDateTimeFormat()
    Gets the sfDateTimeFormatInfo that defines the culturally appropriate
  • array getEnglishName()
    Gets the culture name in English.
  • sfCultureInfo getInstance($culture)
    Gets the sfCultureInfo that for this culture string.
  • sfCultureInfo getInvariantCulture()
    Gets the sfCultureInfo that is culture-independent (invariant).
  • boolean getIsNeutralCulture()
    Gets a value indicating whether the current sfCultureInfo
  • string getLanguage($code)
    Get the language name in the current culture for the given code.
  • array getLanguages($languages)
    Gets a list of languages in the language of the localized version.
  • string getName()
    Gets the culture name in the format
  • array getNativeName()
    Gets the culture name in the language that the culture is set
  • sfNumberFormatInfo getNumberFormat()
    Gets the sfNumberFormatInfo that defines the culturally appropriate
  • sfCultureInfo getParent()
    Gets the sfCultureInfo that represents the parent culture of the
  • array getScripts()
    Gets a list of scripts in the language of the localized version.
  • array getTimeZones()
    Gets a list of timezones in the language of the localized version.
  • loadCultureData($culture)
    Loads the ICU culture data for the specific culture identifier.
  • mixed searchArray($info, $path)
    Searches the array for a specific value using a path separated using
  • setCulture($culture)
    Sets the culture for the current instance. The culture indentifier
  • setDateTimeFormat($dateTimeFormat)
    Sets the date time format information.
  • setNumberFormat($numberFormat)
    Sets the number format information.
  • sortArray()
    sorts the passed array according to the locale of this sfCultureInfo class
  • boolean validCulture($culture)
    Determines if a given culture is valid. Simply checks that the
  • return __construct($culture)
    Initializes a new instance of the sfCultureInfo class based on the
  • mixed __get($name)
    Allows functions that begins with 'set' to be called directly
  • __set($name, $value)
    Allows functions that begins with 'set' to be called directly
  • string __toString()
    Displays the culture name.

Method Details

  • (array) & ($filename)

    $filename the ICU data filename

    Gets the data by unserializing the ICU data from disk.

    The data files are cached in a static variable inside
    this function.

    returns ICU data

  • array_add ()

    Adds an array to an already existing array.

    If an element is already existing in array1 it is not overwritten.
    If this element is an array this logic will be applied recursively.

  • (string) dataDir ()

    Gets the default directory for the ICU data.

    The default is the "data" directory for this class.

    returns directory containing the ICU data.

  • (string) fileExt ()

    Gets the filename extension for ICU data. Default is ".dat".

    returns filename extension for ICU data.

  • (mixed) findInfo ($path, $merge)

    $path the data you want to find.
    $merge merge the data from its parents.

    Finds the specific ICU data information from the data.

    The path to the specific ICU data is separated with a slash "/".
    E.g. To find the default calendar used by the culture, the path
    "calendar/default" will return the corresponding default calendar.
    Use merge=true to return the ICU including the parent culture.
    E.g. The currency data for a variant, say "en_AU" contains one
    entry, the currency for AUD, the other currency data are stored
    in the "en" data file. Thus to retrieve all the data regarding
    currency for "en_AU", you need to use findInfo("Currencies,true);.

    returns the specific ICU data.

  • (string) getCalendar ()

    Gets the default calendar used by the culture, e.g. "gregorian".

    returns the default calendar.

  • (array) getCountries ($countries)

    $countries An array of countries used to restrict the returned array (null by default, which means all countries)

    Gets a list of countries in the language of the localized version.

    returns a list of localized country names.

  • (string) getCountry ($code)

    $code A valid country code

    Get the country name in the current culture for the given code.

    returns The country name in the current culture

  • (array) getCultures ($type)

    $type culture type, sfCultureInfo::ALL, sfCultureInfo::NEUTRAL or sfCultureInfo::SPECIFIC.

    Gets the list of supported cultures filtered by the specified

    culture type. This is an EXPENSIVE function, it needs to traverse
    a list of ICU files in the data directory.
    This function can be called statically.

    returns list of culture information available.

  • (array) getCurrencies ($currencies, $full)

    $currencies An array of currencies used to restrict the returned array (null by default, which means all currencies)
    $full Whether to return the symbol and the name or not (false by default)

    Gets a list of currencies in the language of the localized version.

    returns a list of localized currencies.

  • (string) getCurrency ($code)

    $code A valid currency code

    Get the currency name in the current culture for the given code.

    returns The currency name in the current culture

  • (sfDateTimeFormatInfo) getDateTimeFormat ()

    Gets the sfDateTimeFormatInfo that defines the culturally appropriate

    format of displaying dates and times.

    returns date time format information for the culture.

  • (array) getEnglishName ()

    Gets the culture name in English.

    Returns array('Language','Country');
    'Country' is omitted if the culture is neutral.

    returns array with language and country as elements.

  • (sfCultureInfo) getInstance ($culture)

    $culture The culture for this instance

    Gets the sfCultureInfo that for this culture string.

    returns Invariant culture info is "en"

  • (sfCultureInfo) getInvariantCulture ()

    Gets the sfCultureInfo that is culture-independent (invariant).

    Any changes to the invariant culture affects all other
    instances of the invariant culture.
    The invariant culture is assumed to be "en";

    returns invariant culture info is "en".

  • (boolean) getIsNeutralCulture ()

    Gets a value indicating whether the current sfCultureInfo

    represents a neutral culture. Returns true if the culture
    only contains two characters.

    returns true if culture is neutral, false otherwise.

  • (string) getLanguage ($code)

    $code A valid language code

    Get the language name in the current culture for the given code.

    returns The language name in the current culture

  • (array) getLanguages ($languages)

    $languages An array of languages used to restrict the returned array (null by default, which means all languages)

    Gets a list of languages in the language of the localized version.

    returns list of localized language names.

  • (string) getName ()

    Gets the culture name in the format

    "_(country/regioncode2)".

    returns culture name.

  • (array) getNativeName ()

    Gets the culture name in the language that the culture is set

    to display. Returns array('Language','Country');
    'Country' is omitted if the culture is neutral.

    returns array with language and country as elements, localized.

  • (sfNumberFormatInfo) getNumberFormat ()

    Gets the sfNumberFormatInfo that defines the culturally appropriate

    format of displaying numbers, currency, and percentage.

    returns the number format info for current culture.

  • (sfCultureInfo) getParent ()

    Gets the sfCultureInfo that represents the parent culture of the

    current sfCultureInfo

    returns parent culture information.

  • (array) getScripts ()

    Gets a list of scripts in the language of the localized version.

    returns list of localized script names.

  • (array) getTimeZones ()

    Gets a list of timezones in the language of the localized version.

    returns list of localized timezones.

  • loadCultureData ($culture)

    $culture the culture identifier.

    Loads the ICU culture data for the specific culture identifier.

  • (mixed) searchArray ($info, $path)

    $info the array for search
    $path slash "/" separated array path.

    Searches the array for a specific value using a path separated using

    slash "/" separated path. e.g to find $info['hello']['world'],
    the path "hello/world" will return the corresponding value.

    returns the value array using the path

  • setCulture ($culture)

    $culture culture identifier, e.g. "fr_FR_EURO".

    Sets the culture for the current instance. The culture indentifier

    must be of the form "_(country/region)".

  • setDateTimeFormat ($dateTimeFormat)

    $dateTimeFormat the new date time format info.

    Sets the date time format information.

  • setNumberFormat ($numberFormat)

    $numberFormat the new number format info.

    Sets the number format information.

  • sortArray ()

    sorts the passed array according to the locale of this sfCultureInfo class

  • (boolean) validCulture ($culture)

    $culture a culture

    Determines if a given culture is valid. Simply checks that the

    culture data exists.

    returns true if valid, false otherwise.

  • (return) __construct ($culture)

    $culture a culture name, e.g. "en_AU".

    Initializes a new instance of the sfCultureInfo class based on the

    culture specified by name. E.g. new sfCultureInfo('en_AU');
    The culture indentifier must be of the form
    "_(country/region/variant)".

    returns new sfCultureInfo.

  • (mixed) __get ($name)

    $name The property to get

    Allows functions that begins with 'set' to be called directly

    as an attribute/property to retrieve the value.

  • __set ($name, $value)

    $name The property to set
    $value The property value

    Allows functions that begins with 'set' to be called directly

    as an attribute/property to set the value.

  • (string) __toString ()

    Displays the culture name.

    returns the culture name.