Detailed Description

I18nUtil provides support i18n functionality.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

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 getMessages (   $directory,
  $exclude,
  $pattern,
  $depth = 0 
)
static

Get all messages from a directory recursively.

Parameters
$directoryThe directory to search in
$excludeArray of directory names that are excluded from search
$patternThe pattern the names of the files to search in must match
$depthInternal 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 getMessagesFromFile (   $file)
static

Get all messages from a file.

Searches for parameters of the Message::getText method and usage of the smarty 'translate' function.

Parameters
$fileThe 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 createPHPLanguageFile (   $language,
  $messages 
)
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
$languageThe language of the file (language code e.g. 'de')
$messagesAn 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.