I18nUtil Class Reference
Detailed Description
I18nUtil provides support i18n functionality.
Definition at line 22 of file I18nUtil.php.
Static Public Member Functions | |
static | getMessages ($directory, $exclude, $pattern, $depth=0) |
static | getMessagesFromFile ($file) |
static | createPHPLanguageFile ($language, $messages) |
Member Function Documentation
◆ getMessages()
|
static |
Get all messages from a directory recursively.
- Parameters
-
$directory The directory to search in $exclude Array of directory names that are excluded from search $pattern The pattern the names of the files to search in must match $depth Internal use only
- Returns
- An assoziative array with the filenames as keys and the values as array of strings.
- See also
- I18nUtil::getMessagesFromFile
Definition at line 37 of file I18nUtil.php.
◆ getMessagesFromFile()
|
static |
Get all messages from a file.
Searches for parameters of the Message::getText method and usage of the smarty 'translate' function.
- Parameters
-
$file The file to search in
- Returns
- An array of strings.
- Note
- This method searches for occurrences of '->getText('Text to translate')', 'Dict.translate("Text to translate")' or {translate:"Text to translate"} where 'Text to translate' is supposed to be the message to translate. So it might not find the usage of the getText() method with concatenated strings (like $message->getText($login." says hello")). For replacements use method signatures, that support parameters.
Definition at line 82 of file I18nUtil.php.
◆ createPHPLanguageFile()
|
static |
Create a message file for use with the Message class.
The file will be created in the directory defined in configutation key 'localeDir' in 'application' section.
- Parameters
-
$language The language of the file (language code e.g. 'de') $messages An assoziative array with the messages as keys and assoziative array with keys 'translation' and 'files' (occurences of the message)
- Returns
- Boolean whether successful or not.
Definition at line 118 of file I18nUtil.php.