Index
Locale module
Provides a basic interface to the localization of short texts (less than 256 bytes).
The locale identification string (such as 'en' or 'it')
Constructor
Initializes a TIP_Locale instance.
$options inherits the TIP_Content properties, and add the following: * $options['locale']: the locale identification string (required)
Get a localized text
Given an $id and a $prefix, retrieves the localized text (in the locale specified by the 'locale' option of the main TIP_Application) binded to "$prefix.$id". This means the data object of TIP_Locale must have a series of rows with prefix.id values as the primary key.
The choice of splitting the key in $prefix and $id allows to perform a sort of cached read, that is, to avoid multiple queries, a single request for a specified prefix gets all the id of this prefix. If you are sure the other id are not used (such as for the TIP_Notify module) you can disable the cache by passig false to $cached.
The $context associative array contains a series of key=>value pairs that can be substituted in the localized text. The get() method will search in the localized text for any key enclosed by '|' and will put the corresponding value. For instance, if there is a 'size'=>200 in the $context array, the text 'Max allowed size is |size|...' will expand to 'Max allowed size is 200...'.
TIP_Localewas last modified by TiP on Mon 25 May 2009 06:22:25 PM CEST