sfI18N wraps the core i18n classes for a symfony context.
Method Summary
-
createMessageSource($dir = null)
Returns a new message source.
-
getConfiguration()
Returns the configuration instance.
-
string
getCountry($iso, $culture = null)
Gets a country name.
-
string
getCulture()
Gets the current culture for i18n format objects.
-
array
getDateForCulture($date, $culture = null)
Returns the day, month and year from a date formatted with a given culture.
-
getMessageFormat()
Gets the message format.
-
getMessageSource()
Gets the message source.
-
string
getNativeName($culture)
Gets a native culture name.
-
array
getOptions()
Returns the initialization options
-
array
getTimeForCulture($time, $culture)
Returns the hour, minute from a date formatted with a given culture.
-
integer
getTimestampForCulture($dateTime, $culture = null)
Returns a timestamp from a date with time formatted with a given culture.
-
initialize($configuration, $cache = null, $options = array())
Initializes this class.
-
Boolean
isMessageSourceFileBased($source)
Returns true if messages are stored in a file.
-
listenToChangeActionEvent($event)
Listens to the controller.change_action event.
-
listenToChangeCultureEvent($event)
Listens to the user.change_culture event.
-
setCulture($culture)
Sets the current culture for i18n format objects.
-
setMessageSource($dirs, $culture = null)
Sets the message source.
-
string
__($string, $args = array(), $catalogue = 'messages')
Gets the translation for the given string
-
__construct($configuration, $cache = null, $options = array())
Class constructor.
Method Details
-
createMessageSource ($dir = null)
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
-
Returns the configuration instance.
returns An sfApplicationConfiguration instance
-
(string) getCountry ($iso, $culture = null)
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 = null)
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
-
Gets the message format.
returns A sfMessageFormat object
-
Gets the message source.
returns A sfMessageSource object
-
(string) getNativeName ($culture)
Browse code
Gets a native culture name.
returns The culture name
-
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 = null)
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 = null, $options = array())
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
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.
-
Sets the current culture for i18n format objects.
-
setMessageSource ($dirs, $culture = null)
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 = array(), $catalogue = 'messages')
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 ($configuration, $cache = null, $options = array())
Browse code
| $configuration |
|
| $cache |
|
| $options |
|
Class constructor.
|