Cradle
0.3.3
Simple library for creating Web-based applications
|
Multi language messages. More...
Static Public Member Functions | |
static | setTextDomain ($domain, $rootDir, $codeset='UTF-8') |
static | useTextDomain ($domain) |
static | _ ($text) |
Static Public Attributes | |
static | $textDomains = null |
static | $language = "" |
Multi language messages.
Class to support of multi language messages. Wrap of GNU "gettext" utility and its simplest replacement (just in case).
|
static |
GNU gettext
utility simplest replacement.
If you can't use the gettext
for any reason, the simplest way to replace it is to use this method.
But in this case you should keep your translation messages in php file (for directory structure see: setTextDomain
). The php file mast returns an array of structure:
string | $text | text message |
|
static |
To set params of current text domain for translations.
(wrap of gettext
)
string | $domain | The name of the text domain |
string | $rootDir | Root directory to find translations The root directory structure:
(`gettext` native)
/$rootDir
$language/LC_MESSAGES/domainName.mo
For example:
messages/
en/LC_MESSAGES/domainName.mo
ru/LC_MESSAGES/domainName.mo
...
(`gettext` replacment by self::_ )
/$rootDir
$language/domainName.php
For example:
messages/
en/domainName.php
ru/domainName.php
...
|
string | $codeset | UTF-8 by default. |
|
static |
Change current text domain for translation.
(wrap of gettext
)
Property self::$textDomains
mast be defined before
string | $domain | The name of the current text domain |
|
static |
Current language
|
static |
Array of text domains for translations
Structure: