wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
I18nUtil Class Reference

Public Member Functions

 getErrorMsg ()
 
 getMessages ($directory, $pattern, $depth=0)
 
 getMessagesFromFile ($file)
 
 createPOFile ($projectID, $teamName, $teamEmail, $language, $country, $charset, $filename, $messages)
 

Public Attributes

 $_errorMsg = ''
 

Detailed Description

I18nUtil provides support i18n functionality.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.I18nUtil.php 1462 2014-02-04 23:52:27Z iherwig
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 29 of file class.I18nUtil.php.

Member Function Documentation

I18nUtil::getErrorMsg ( )

Get last error message.

Returns
The error string

Definition at line 37 of file class.I18nUtil.php.

References $_errorMsg.

I18nUtil::getMessages (   $directory,
  $pattern,
  $depth = 0 
)

Get all messages from a directory recursively.

Parameters
directoryThe directory to search in
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 49 of file class.I18nUtil.php.

References getMessagesFromFile().

+ Here is the call graph for this function:

I18nUtil::getMessagesFromFile (   $file)

Get all messages from a file. Searches for parameters of the Message::get method and usage of the smarty 'translate' function.

Parameters
fileThe file to search in
Returns
An array of strings.
Note
This method searches for occurences of 'Message::get("...")', 'Message::get('...')' and 'translate text="..."' where '...' is supposed to be the message to translate. So it might not find the usage of the Message::get() method with concatenated strings (like Message::get($login." says hello")). But this usage is not recommended anyway (see Message::get()).

Definition at line 94 of file class.I18nUtil.php.

Referenced by getMessages().

I18nUtil::createPOFile (   $projectID,
  $teamName,
  $teamEmail,
  $language,
  $country,
  $charset,
  $filename,
  $messages 
)

Create a message catalog (*.PO file) for use with 'gettext'. The file will be created in the directory 'localeDir/language/LC_MESSAGES/' where 'localeDir' must be given in the configuration file section 'cms'.

Parameters
projectIDThe name of the project
teamNameThe name of the translation team
teamEmailThe email of the translation team
languageThe language of the file (language code e.g. 'de')
countryThe country of the file (country code e.g. 'DE')
charsetThe charset used (e.g. 'iso-8859-1')
filenameThe name of the file (The Message::get method uses 'main' per default)
messagesAn assoziative array with the messages as keys (becomes 'msgid' in the *.PO file) and assoziative array values with keys 'translation' (becomes 'msgstr' in the *.PO file), 'files' (becomes the reference comment)
Returns
True/False whether successful or not.

Definition at line 128 of file class.I18nUtil.php.

References InifileParser\getInstance().

+ Here is the call graph for this function:

Member Data Documentation

I18nUtil::$_errorMsg = ''

Definition at line 31 of file class.I18nUtil.php.

Referenced by getErrorMsg().


The documentation for this class was generated from the following file: