Open Journal Systems  3.3.0
LocaleFile Class Reference

Public Member Functions

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

Static Public Member Functions

static & load ($filename)
 

Data Fields

 $cache
 
 $filename
 
 $locale
 

Detailed Description

Abstraction of a locale file.

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

Constructor & Destructor Documentation

◆ __construct()

LocaleFile::__construct (   $locale,
  $filename 
)

Constructor.

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

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

References $filename, and $locale.

Member Function Documentation

◆ _cacheMiss()

LocaleFile::_cacheMiss (   $cache,
  $id 
)

Register a cache miss.

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

Referenced by translate().

◆ _getCache()

LocaleFile::_getCache (   $locale)

Get the cache object for this locale file.

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

References $cache, CacheManager\getManager(), and load().

Referenced by translate().

◆ getFilename()

LocaleFile::getFilename ( )

Get the filename for this locale file.

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

References $filename.

◆ isValid()

LocaleFile::isValid ( )

Check if a locale is valid.

Parameters
$localestring
Returns
boolean

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

Referenced by testLocale(), and translate().

◆ load()

static& LocaleFile::load (   $filename)
static

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

Parameters
$filenamestring Filename to locale XML to load
array

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

References $filename.

Referenced by _getCache(), and testLocale().

◆ testLocale()

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 172 of file LocaleFile.inc.php.

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

◆ translate()

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 93 of file LocaleFile.inc.php.

References $cache, _cacheMiss(), _getCache(), and isValid().

Field Documentation

◆ $cache

object LocaleFile::$cache

Cache of this locale file

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

Referenced by _getCache(), and translate().

◆ $filename

string LocaleFile::$filename

The filename for this locale file

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

Referenced by __construct(), getFilename(), and load().

◆ $locale

string LocaleFile::$locale

The identifier for this locale file

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

Referenced by __construct().


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