I18n Class Info:
- Class Declaration:
class I18n
- File name:
- Cake/I18n/I18n.php
- Description:
I18n handles translation of Text and time format strings.
- Package
- Cake.I18n
Properties:
-
_categories array
Translation categories
-
category string
Current category of translation
-
defaultDomain string
Default domain of translation
-
domain string
Current domain of translation
-
_domains array
Translation strings for a specific domain read from the .mo or .po files
-
_escape
-
l10n L10n
Instance of the L10n class for localization
-
_lang string
Current language used for translations
-
_noLocale boolean
Set to true when I18N::_bindTextDomain() is called for the first time. If a translation file is found it is set to false again
Method Summary:
- _bindTextDomain( $domain )
- clear( )
- __construct( )
- domains( )
- getInstance( )
- loadLocaleDefinition( $filename )
- loadMo( $filename )
- loadPo( $filename )
- _parseLiteralValue( $string )
- _pluralGuess( $header, $n )
- translate( $singular, $plural = NULL, $domain = NULL, $category = 6, $count = NULL, $language = NULL )
- _translateTime( $format, $domain )
_bindTextDomain
topBinds the given domain to a file in the specified directory.
- Parameters:
-
-
string $domain required
Domain to bind
-
- Method defined in:
- Cake/I18n/I18n.php on line 302
- Return
string Domain binded
clear
topClears the domains internal data array. Useful for testing i18n.
- Method defined in:
- Cake/I18n/I18n.php on line 232
- Return
void
__construct
topConstructor, use I18n::getInstance() to get the i18n translation object.
- Method defined in:
- Cake/I18n/I18n.php on line 107
- Return
void
domains
topgetInstance
topReturn a static instance of the I18n class
- Method defined in:
- Cake/I18n/I18n.php on line 116
- Return
I18n
loadLocaleDefinition
topParses a locale definition file following the POSIX standard
- Parameters:
-
-
string $filename required
Locale definition filename
-
- Method defined in:
- Cake/I18n/I18n.php on line 523
- Return
mixed Array of definitions on success or false on failure
loadMo
topLoads the binary .mo file and returns array of translations
- Parameters:
-
-
string $filename required
Binary .mo file to load
-
- Method defined in:
- Cake/I18n/I18n.php on line 404
- Return
mixed Array of translations on success or false on failure
loadPo
topLoads the text .po file and returns array of translations
- Parameters:
-
-
string $filename required
Text .po file to load
-
- Method defined in:
- Cake/I18n/I18n.php on line 449
- Return
mixed Array of translations on success or false on failure
_parseLiteralValue
topAuxiliary function to parse a symbol from a locale definition file
- Parameters:
-
-
string $string required
Symbol to be parsed
-
- Method defined in:
- Cake/I18n/I18n.php on line 591
- Return
string parsed symbol
_pluralGuess
topAttempts to find the plural form of a string.
- Parameters:
-
-
string $header required
Type
-
integer $n required
Number
-
- Method defined in:
- Cake/I18n/I18n.php on line 254
- Return
integer plural match
translate
topUsed by the translation functions in basics.php Returns a translated string based on current language and translation files stored in locale folder
- Parameters:
-
-
string $singular required
String to translate
-
string $plural optional NULL
Plural string (if any)
-
string $domain optional NULL
Domain The domain of the translation. Domains are often used by plugin translations
-
string $category optional 6
Category The integer value of the category to use.
-
integer $count optional NULL
Count Count is used with $plural to choose the correct plural form.
-
string $language optional NULL
Language to translate string to. If null it checks for language in session followed by Config.language configuration variable.
-
- Method defined in:
- Cake/I18n/I18n.php on line 137
- Return
string translated string.
_translateTime
topReturns a Time format definition from corresponding domain
- Parameters:
-
-
string $format required
Format to be translated
-
string $domain required
Domain where format is stored
-
- Method defined in:
- Cake/I18n/I18n.php on line 622
- Return
mixed translated format string if only value or array of translated strings for corresponding format.
