symfony API

sfCultureInfo Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.1 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.1 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.
  • 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()
    Gets a list of countries in the language of the localized version.
  • array getCultures($type)
    Gets the list of supported cultures filtered by the specified
  • array getCurrencies()
    Gets a list of currencies in the language of the localized version.
  • 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
  • array getLanguages()
    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.
  • array simplify($array)
    Simplifies a single element array into its own value.
  • 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) Browse code

    $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

  • (string) dataDir () Browse code

    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 () Browse code

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

    returns filename extension for ICU data.

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

    $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 () Browse code

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

    returns the default calendar.

  • (array) getCountries () Browse code

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

    returns a list of localized country names.

  • (array) getCultures ($type) Browse code

    $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 () Browse code

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

    returns a list of localized currencies.

  • (sfDateTimeFormatInfo) getDateTimeFormat () Browse code

    Gets the sfDateTimeFormatInfo that defines the culturally appropriate

    format of displaying dates and times.

    returns date time format information for the culture.

  • (array) getEnglishName () Browse code

    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) Browse code

    $culture The culture for this instance

    Gets the sfCultureInfo that for this culture string.

    returns Invariant culture info is "en"

  • (sfCultureInfo) getInvariantCulture () Browse code

    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 () Browse code

    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.

  • (array) getLanguages () Browse code

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

    returns list of localized language names.

  • (string) getName () Browse code

    Gets the culture name in the format

    "_(country/regioncode2)".

    returns culture name.

  • (array) getNativeName () Browse code

    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 () Browse code

    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 () Browse code

    Gets the sfCultureInfo that represents the parent culture of the

    current sfCultureInfo

    returns parent culture information.

  • (array) getScripts () Browse code

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

    returns list of localized script names.

  • (array) getTimeZones () Browse code

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

    returns list of localized timezones.

  • loadCultureData ($culture) Browse code

    $culture the culture identifier.

    Loads the ICU culture data for the specific culture identifier.

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

    $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) Browse code

    $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) Browse code

    $dateTimeFormat the new date time format info.

    Sets the date time format information.

  • setNumberFormat ($numberFormat) Browse code

    $numberFormat the new number format info.

    Sets the number format information.

  • (array) simplify ($array) Browse code

    $array with single elements arrays

    Simplifies a single element array into its own value.

    E.g. array(0 => array('hello'), 1 => 'world');
    becomes array(0 => 'hello', 1 => 'world');

    returns simplified array.

  • (boolean) validCulture ($culture) Browse code

    $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) Browse code

    $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) Browse code

    $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) Browse code

    $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 () Browse code

    Displays the culture name.

    returns the culture name.