Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PKPLocale Class Reference
Inheritance diagram for PKPLocale:
AppLocale AppLocale

Static Public Member Functions

static _allLocalesCacheMiss ($cache, $id)
 
static & _getAllLocalesCache ()
 
static & _getAllLocalesCacheContent ()
 
static get2LetterFrom3LetterIsoLanguage ($iso3Letter)
 
static get3LetterFrom2LetterIsoLanguage ($iso2Letter)
 
static get3LetterIsoFromLocale ($locale)
 
static & getAllLocales ()
 
static getFilenameComponentMap ($locale)
 
static getIso1FromIso3 ($iso3)
 
static getIso1FromLocale ($locale)
 
static getIso3FromIso1 ($iso1)
 
static getIso3FromLocale ($locale)
 
static & getLocaleFiles ($locale=null)
 
static getLocaleFrom3LetterIso ($iso3Letter)
 
static getLocaleFromIso3 ($iso3)
 
static getLocaleStyleSheet ($locale)
 
static getParameterNames ($source)
 
static getTimeZone ()
 
static initialize ($request)
 
static installLocale ($locale)
 
static isLocaleComplete ($locale)
 
static isLocaleValid ($locale)
 
static & loadLocaleList ($filename)
 
static makeComponentMap ($locale)
 
static registerLocaleFile ($locale, $filename, $addToTop=false)
 
static reloadLocale ($locale)
 
static requireComponents ()
 
static translate ($key, $params=array(), $locale=null)
 
static uninstallLocale ($locale)
 

Detailed Description

Provides methods for loading locale data and translating strings identified by unique keys.

Definition at line 70 of file PKPLocale.inc.php.

Member Function Documentation

static PKPLocale::_allLocalesCacheMiss (   $cache,
  $id 
)
static

Create a cache file with locale data.

Parameters
$cacheCacheManager
$idthe cache id (not used here, required by the cache manager)

Definition at line 631 of file PKPLocale.inc.php.

References Registry\get(), and loadLocaleList().

static& PKPLocale::_getAllLocalesCache ( )
static

Get the cache object for the current list of all locales.

Returns
FileCache

Definition at line 608 of file PKPLocale.inc.php.

References Registry\get().

Referenced by _getAllLocalesCacheContent().

static& PKPLocale::_getAllLocalesCacheContent ( )
static
static PKPLocale::get2LetterFrom3LetterIsoLanguage (   $iso3Letter)
static

Translate the ISO 3-letter language string (ISO639-2b) into a ISO compatible 2-letter string (ISO639-1).

Parameters
$iso3Letterstring
Returns
string the translated string or null if we don't know about the given language.

Definition at line 403 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent().

Referenced by PKPLocaleTest\testGet2LetterFrom3LetterIsoLanguage().

static PKPLocale::get3LetterFrom2LetterIsoLanguage (   $iso2Letter)
static

Translate the ISO 2-letter language string (ISO639-1) into a ISO compatible 3-letter string (ISO639-2b).

Parameters
$iso2Letterstring
Returns
string the translated string or null if we don't know about the given language.

Definition at line 384 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent().

Referenced by get3LetterIsoFromLocale(), and PKPLocaleTest\testGet3LetterFrom2LetterIsoLanguage().

static PKPLocale::get3LetterIsoFromLocale (   $locale)
static

Translate the PKP locale identifier into an ISO639-2b compatible 3-letter string.

Parameters
$localestring
Returns
string

Definition at line 421 of file PKPLocale.inc.php.

References get3LetterFrom2LetterIsoLanguage().

Referenced by Mods34DescriptionXmlFilter\_buildDocumentHierarchy(), and PKPLocaleTest\testGet3LetterIsoFromLocale().

static PKPLocale::getFilenameComponentMap (   $locale)
static

Get an associative array of LOCALE_COMPOMENT_... => filename

Parameters
$localestring
Returns
array

Definition at line 165 of file PKPLocale.inc.php.

References Registry\get(), and AppLocale\makeComponentMap().

Referenced by requireComponents(), and TranslatorAction\testLocale().

static PKPLocale::getIso1FromIso3 (   $iso3)
static

Translate the ISO639-3 into ISO639-1.

Parameters
$iso3string
Returns
string the translated string or null if we don't know about the given language.

Definition at line 502 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent().

static PKPLocale::getIso1FromLocale (   $locale)
static

Translate the PKP locale identifier into an ISO639-1 compatible 2-letter string.

Parameters
$localestring
Returns
string

Definition at line 532 of file PKPLocale.inc.php.

static PKPLocale::getIso3FromIso1 (   $iso1)
static

Translate the ISO 2-letter language string (ISO639-1) into ISO639-3.

Parameters
$iso1string
Returns
string the translated string or null if we don't know about the given language.

Definition at line 484 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent().

Referenced by getIso3FromLocale().

static PKPLocale::getIso3FromLocale (   $locale)
static

Translate the PKP locale identifier into an ISO639-3 compatible 3-letter string.

Parameters
$localestring
Returns
string

Definition at line 520 of file PKPLocale.inc.php.

References getIso3FromIso1().

static& PKPLocale::getLocaleFiles (   $locale = null)
static

Get a list of locale files currently registered, either in all locales (in an array for each locale), or for a specific locale.

Parameters
$localestring Locale identifier (optional)

Definition at line 78 of file PKPLocale.inc.php.

References Registry\get().

Referenced by registerLocaleFile(), and translate().

static PKPLocale::getLocaleFrom3LetterIso (   $iso3Letter)
static

Translate an ISO639-2b compatible 3-letter string into the PKP locale identifier.

This can be ambiguous if several locales are defined for the same language. In this case we'll use the primary locale to disambiguate.

If that still doesn't determine a unique locale then we'll choose the first locale found.

Parameters
$iso3letterstring
Returns
string

Definition at line 441 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent(), AppLocale\getPrimaryLocale(), and AppLocale\getSupportedLocales().

Referenced by PKPLocaleTest\testGetLocaleFrom3LetterIso().

static PKPLocale::getLocaleFromIso3 (   $iso3)
static

Translate an ISO639-3 compatible 3-letter string into the PKP locale identifier.

This can be ambiguous if several locales are defined for the same language. In this case we'll use the primary locale to disambiguate.

If that still doesn't determine a unique locale then we'll choose the first locale found.

Parameters
$iso3string
Returns
string

Definition at line 551 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent(), AppLocale\getPrimaryLocale(), and AppLocale\getSupportedLocales().

static PKPLocale::getLocaleStyleSheet (   $locale)
static

Get the stylesheet filename for a particular locale. (These can be optionally specified to deal with things like RTL directionality.)

Parameters
$localestring
Returns
string or null if none configured.

Definition at line 250 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent().

Referenced by PKPLocaleTest\testGetLocaleStylesheet().

static PKPLocale::getParameterNames (   $source)
static

Given a locale string, get the list of parameter references of the form {$myParameterName}.

Parameters
$sourcestring
Returns
array

Definition at line 369 of file PKPLocale.inc.php.

References String\regexp_match_all().

Referenced by TranslatorAction\testEmails().

static PKPLocale::getTimeZone ( )
static

Get the sites time zone.

Returns
string Time zone

Definition at line 650 of file PKPLocale.inc.php.

References DAORegistry\getDAO(), and Config\getVar().

static PKPLocale::initialize (   $request)
static

Initialize the locale system.

Parameters
$requestPKPRequest

Definition at line 119 of file PKPLocale.inc.php.

References AppLocale\getLocale().

static PKPLocale::installLocale (   $locale)
static

Install support for a new locale.

Parameters
$localestring

Definition at line 328 of file PKPLocale.inc.php.

References HookRegistry\call(), PluginRegistry\getCategories(), DAORegistry\getDAO(), and PluginRegistry\loadCategory().

static PKPLocale::isLocaleComplete (   $locale)
static

Determine whether or not a locale is marked incomplete.

Parameters
$localexx_XX symbolic name of locale to check
Returns
boolean

Definition at line 263 of file PKPLocale.inc.php.

References _getAllLocalesCacheContent().

Referenced by PKPLocaleTest\testIsLocaleComplete().

static& PKPLocale::loadLocaleList (   $filename)
static

Load a locale list from a file.

Parameters
$filenamestring
Returns
array

Definition at line 289 of file PKPLocale.inc.php.

Referenced by _allLocalesCacheMiss(), and PKPLanguageAction\getDownloadableLocales().

static PKPLocale::makeComponentMap (   $locale)
static

Build an associative array of LOCALE_COMPOMENT_... => filename (use getFilenameComponentMap instead)

Parameters
$localestring
Returns
array

Definition at line 142 of file PKPLocale.inc.php.

static PKPLocale::registerLocaleFile (   $locale,
  $filename,
  $addToTop = false 
)
static

Register a locale file against the current list.

Parameters
$localestring Locale key
$filenamestring Filename to new locale XML file
$addToTopboolean Whether to add to the top of the list (true) or the bottom (false). Allows overriding.

Definition at line 226 of file PKPLocale.inc.php.

References HookRegistry\call(), and getLocaleFiles().

static PKPLocale::reloadLocale (   $locale)
static

Reload locale-specific data.

Parameters
$localestring

Definition at line 358 of file PKPLocale.inc.php.

References AppLocale\installLocale(), and AppLocale\uninstallLocale().

static PKPLocale::requireComponents ( )
static

Load a set of locale components. Parameters of mixed length may be supplied, each a LOCALE_COMPONENT_... constant. An optional final parameter may be supplied to specify the locale (e.g. 'en_US').

Definition at line 178 of file PKPLocale.inc.php.

References Registry\get(), getFilenameComponentMap(), and AppLocale\getLocale().

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

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 96 of file PKPLocale.inc.php.

References Registry\get(), AppLocale\getLocale(), and getLocaleFiles().

static PKPLocale::uninstallLocale (   $locale)
static

Uninstall support for an existing locale.

Parameters
$localestring

Definition at line 347 of file PKPLocale.inc.php.

References DAORegistry\getDAO().


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