Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
LocaleFile Class Reference
Inheritance diagram for LocaleFile:
EditableLocaleFile

Public Member Functions

 _cacheMiss (&$cache, $id)
 
_getCache ($locale)
 
 getFilename ()
 
 isValid ()
 
load ($filename)
 
 LocaleFile ($locale, $filename)
 
 testLocale (&$referenceLocaleFile)
 
 translate ($key, $params=array(), $locale=null)
 

Detailed Description

Abstraction of a locale file.

Definition at line 17 of file LocaleFile.inc.php.

Member Function Documentation

LocaleFile::_cacheMiss ( $cache,
  $id 
)

Register a cache miss.

Definition at line 64 of file LocaleFile.inc.php.

Referenced by translate().

& LocaleFile::_getCache (   $locale)

Get the cache object for this locale file.

Definition at line 40 of file LocaleFile.inc.php.

References load().

Referenced by translate().

LocaleFile::getFilename ( )

Get the filename for this locale file.

Definition at line 71 of file LocaleFile.inc.php.

LocaleFile::isValid ( )

Check if a locale is valid.

Parameters
$localestring
Returns
boolean

Definition at line 140 of file LocaleFile.inc.php.

Referenced by testLocale().

& LocaleFile::load (   $filename)

Static method: Load a locale array from a file. Not cached!

Parameters
$filenamestring Filename to locale XML to load
array

Definition at line 118 of file LocaleFile.inc.php.

Referenced by _getCache(), genTestLocale\generateLocaleFile(), and testLocale().

LocaleFile::LocaleFile (   $locale,
  $filename 
)

Constructor.

Parameters
$localestring Key for this locale file
$filenamestring Filename to this locale file

Definition at line 32 of file LocaleFile.inc.php.

LocaleFile::testLocale ( $referenceLocaleFile)

Test a locale file against the given reference locale file and return an array of errorType => array(errors).

Parameters
$referenceLocaleFileobject
Returns
array

Definition at line 150 of file LocaleFile.inc.php.

References PKPLocale\getParameterNames(), isValid(), and load().

LocaleFile::translate (   $key,
  $params = array(),
  $locale = null 
)

Translate a string using the selected locale. Substitution works by replacing tokens like "{$foo}" with the value of the parameter named "foo" (if supplied).

Parameters
$keystring
$paramsarray named substitution parameters
$localestring the locale to use
Returns
string

Definition at line 84 of file LocaleFile.inc.php.

References _cacheMiss(), and _getCache().


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