symfony API

sfI18N Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.4 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:

sfI18N wraps the core i18n classes for a symfony context.

Method Summary

Method Details

  • (sfMessageSource) createMessageSource ($dir) Browse code

    $dir An array of i18n directories to create a XLIFF or gettext message source, null otherwise

    Returns a new message source.

    returns A sfMessageSource object

  • (sfApplicationConfiguration) getConfiguration () Browse code

    Returns the configuration instance.

    returns An sfApplicationConfiguration instance

  • (string) getCountry ($iso, $culture) Browse code

    $iso The ISO code
    $culture The culture for the translation

    Gets a country name.

    returns The country name

  • (string) getCulture () Browse code

    Gets the current culture for i18n format objects.

    returns The culture

  • (array) getDateForCulture ($date, $culture) Browse code

    $date The formatted date as string
    $culture The culture

    Returns the day, month and year from a date formatted with a given culture.

    returns An array with the day, month and year

  • (sfMessageFormat) getMessageFormat () Browse code

    Gets the message format.

    returns A sfMessageFormat object

  • (sfMessageSource) getMessageSource () Browse code

    Gets the message source.

    returns A sfMessageSource object

  • (string) getNativeName ($culture) Browse code

    $culture The culture

    Gets a native culture name.

    returns The culture name

  • (array) getOptions () Browse code

    Returns the initialization options

    returns The options used to initialize sfI18n

  • (array) getTimeForCulture ($time, $culture) Browse code

    $time The formatted date as string
    $culture The culture

    Returns the hour, minute from a date formatted with a given culture.

    returns An array with the hour and minute

  • (integer) getTimestampForCulture ($dateTime, $culture) Browse code

    $dateTime The formatted date with time as string
    $culture The culture

    Returns a timestamp from a date with time formatted with a given culture.

    returns The timestamp

  • initialize ($configuration, $cache, $options) Browse code

    $configuration A sfApplicationConfiguration instance
    $cache A sfCache instance
    $options An array of options

    Initializes this class.


    Available options:

    * culture: The culture
    * source: The i18n source (XLIFF by default)
    * debug: Whether to enable debug or not (false by default)
    * database: The database name (default by default)
    * untranslated_prefix: The prefix to use when a message is not translated
    * untranslated_suffix: The suffix to use when a message is not translated

  • (Boolean) isMessageSourceFileBased ($source) Browse code

    $source The source name

    Returns true if messages are stored in a file.

    returns true if messages are stored in a file, false otherwise

  • listenToChangeActionEvent ($event) Browse code

    $event An sfEvent instance

    Listens to the controller.change_action event.

  • listenToChangeCultureEvent ($event) Browse code

    $event An sfEvent instance

    Listens to the user.change_culture event.

  • setCulture ($culture) Browse code

    $culture The culture

    Sets the current culture for i18n format objects.

  • setMessageSource ($dirs, $culture) Browse code

    $dirs An array of i18n directories if message source is a sfMessageSource_File subclass, null otherwise
    $culture The culture

    Sets the message source.

  • (string) __ ($string, $args, $catalogue) Browse code

    $string The string to translate
    $args An array of arguments for the translation
    $catalogue The catalogue name

    Gets the translation for the given string

    returns The translated string

  • __construct () Browse code

    Class constructor.