Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
PKPLocale Class Reference
Inheritance diagram for PKPLocale:
AppLocale AppLocale

Public Member Functions

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

Detailed Description

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

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

Member Function Documentation

PKPLocale::_allLocalesCacheMiss ( $cache,
  $id 
)

Create a cache file with locale data.

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

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

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

& PKPLocale::_getAllLocalesCache ( )

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

Returns
FileCache

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

References Registry\get().

Referenced by _getAllLocalesCacheContent().

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

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

References _getAllLocalesCacheContent().

Referenced by Mods34SchemaSubmissionAdapter\injectMetadataIntoDataObject(), and PKPLocaleTest\testGet2LetterFrom3LetterIsoLanguage().

PKPLocale::get3LetterFrom2LetterIsoLanguage (   $iso2Letter)

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

References _getAllLocalesCacheContent().

Referenced by SolrWebService\_addArticleXml(), Mods34SchemaSubmissionAdapter\extractMetadataFromDataObject(), get3LetterIsoFromLocale(), PKPLocaleTest\testGet3LetterFrom2LetterIsoLanguage(), and DOIExportDom\translateLanguageToLocale().

PKPLocale::get3LetterIsoFromLocale (   $locale)
PKPLocale::getFilenameComponentMap (   $locale)

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

Parameters
$localestring
Returns
array

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

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

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

PKPLocale::getIso1FromIso3 (   $iso3)

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

References _getAllLocalesCacheContent().

PKPLocale::getIso1FromLocale (   $locale)

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

Parameters
$localestring
Returns
string

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

Referenced by DOIExportPlugin\_prepareGalleyData(), and DataciteExportDom\generate().

PKPLocale::getIso3FromIso1 (   $iso1)

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

References _getAllLocalesCacheContent().

Referenced by getIso3FromLocale().

PKPLocale::getIso3FromLocale (   $locale)

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

Parameters
$localestring
Returns
string

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

References getIso3FromIso1().

Referenced by Dc11SchemaArticleAdapter\extractMetadataFromDataObject().

& PKPLocale::getLocaleFiles (   $locale = null)

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

References Registry\get().

Referenced by registerLocaleFile(), and translate().

PKPLocale::getLocaleFrom3LetterIso (   $iso3Letter)

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

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

Referenced by SolrWebService\_addArticleXml(), Mods34SchemaSubmissionAdapter\injectMetadataIntoDataObject(), PKPLocaleTest\testGetLocaleFrom3LetterIso(), and DOIExportDom\translateLanguageToLocale().

PKPLocale::getLocaleFromIso3 (   $iso3)

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

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

PKPLocale::getLocaleStyleSheet (   $locale)

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

References _getAllLocalesCacheContent().

Referenced by PKPLocaleTest\testGetLocaleStylesheet().

PKPLocale::getParameterNames (   $source)

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

Parameters
$sourcestring
Returns
array

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

References String\regexp_match_all().

Referenced by TranslatorAction\testEmails(), and LocaleFile\testLocale().

PKPLocale::initialize ( )

Initialize the locale system.

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

References AppLocale\getLocale().

PKPLocale::installLocale (   $locale)

Install support for a new locale.

Parameters
$localestring

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

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

Referenced by AdminLanguagesHandler\installLocale(), and reloadLocale().

PKPLocale::isLocaleComplete (   $locale)

Determine whether or not a locale is marked incomplete.

Parameters
$localexx_XX symbolic name of locale to check
Returns
boolean

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

References _getAllLocalesCacheContent().

Referenced by InstallForm\InstallForm(), AdminLanguagesHandler\languages(), and PKPLocaleTest\testIsLocaleComplete().

& PKPLocale::loadLocaleList (   $filename)

Load a locale list from a file.

Parameters
$filenamestring
Returns
array

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

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

PKPLocale::makeComponentMap (   $locale)

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

Parameters
$localestring
Returns
array

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

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

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

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

PKPLocale::reloadLocale (   $locale)

Reload locale-specific data.

Parameters
$localestring

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

References installLocale(), and uninstallLocale().

Referenced by AdminLanguagesHandler\reloadLocale().

PKPLocale::requireComponents ( )

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

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

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

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

PKPLocale::uninstallLocale (   $locale)

Uninstall support for an existing locale.

Parameters
$localestring

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

References DAORegistry\getDAO().

Referenced by reloadLocale(), and AdminLanguagesHandler\uninstallLocale().


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