sfI18N wraps the core i18n classes for a symfony context.
Method Summary
-
sfMessageSource
createMessageSource($dir)
Returns a new message source.
-
sfApplicationConfiguration
getConfiguration()
Returns the configuration instance.
-
string
getCountry($iso, $culture)
Gets a country name.
-
string
getCulture()
Gets the current culture for i18n format objects.
-
array
getDateForCulture($date, $culture)
Returns the day, month and year from a date formatted with a given culture.
-
sfMessageFormat
getMessageFormat()
Gets the message format.
-
sfMessageSource
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)
Returns a timestamp from a date with time formatted with a given culture.
-
initialize($configuration, $cache, $options)
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)
Sets the message source.
-
string
__($string, $args, $catalogue)
Gets the translation for the given string
-
__construct()
Class constructor.
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
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)
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
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)
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
-
Class constructor.
|