Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Locale_Manager Class Reference
Inheritance diagram for Locale_Manager:
MySource_Object

Public Member Functions

 __construct ()
 
 __destruct ()
 
 getCurrentLocale ()
 
 getLocaleName ($locale_code=NULL)
 
 setCurrentLocale ($locale)
 
 restoreCurrentLocale ()
 
 getLocaleParts ($locale)
 
 getCumulativeLocaleParts ($locale, $lang_sep='_', $var_sep='@')
 
 getString ($string_code)
 
 includeAssetStrings ($type_code, $locale=NULL)
 
 includePackageStrings ($package_name, $locale=NULL)
 
 includeCoreStrings ($locale=NULL)
 
 raiseError ($code, $error_level)
 
 getErrorMessage ($code)
 
 getInternalMessageSubject ($type, $keywords, $locale=NULL)
 
 getInternalMessageBody ($type, $keywords, $locale=NULL)
 
 getJavascriptIncludes ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $locale_stack = Array()
 
 $_strings = Array()
 
 $_errors = Array()
 
 $_internal_messages = Array()
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Detailed Description

Definition at line 32 of file locale_manager.inc.

Constructor & Destructor Documentation

__construct ( )

Constructor

Returns
void public

Definition at line 108 of file locale_manager.inc.

__destruct ( )

Destructor

Attempts to save state in Deja Vu to improve performance.

Returns
void

Definition at line 122 of file locale_manager.inc.

Member Function Documentation

getCumulativeLocaleParts (   $locale,
  $lang_sep = '_',
  $var_sep = '@' 
)

Splits up the locale passed into language, country, and variant and return an array consisting of all possible partial locales

This will return an array of between one and three elements, depending on what parts of the locale are in there. For example, if locale = 'fr_FR', this will return ['fr', 'fr_FR', 'fr_FR']

Parameters
string$localethe locale that we are going to split
string$lang_seplanguage seperator character
string$var_sepvariant seperator character
Returns
array public

Definition at line 267 of file locale_manager.inc.

getCurrentLocale ( )

Gets the code of the current locale

Returns the code of the current language, or boolean FALSE if locale stack underflowed

Returns
mixed string|boolean public

Definition at line 144 of file locale_manager.inc.

getErrorMessage (   $code)

fetches an error translation for the current locale

Parameters
string$codethe error code
Returns
void public

Definition at line 560 of file locale_manager.inc.

getInternalMessageBody (   $type,
  $keywords,
  $locale = NULL 
)

fetches an internal message subject translation for the current locale

Parameters
string$typethe internal message type
array$keywordsarray of keywords
string$localename of the locale
Returns
void public

Definition at line 644 of file locale_manager.inc.

getInternalMessageSubject (   $type,
  $keywords,
  $locale = NULL 
)

fetches an internal message subject translation for the current locale

Parameters
string$typethe internal message type
array$keywordsarray of keywords
string$localename of the locale
Returns
void public

Definition at line 607 of file locale_manager.inc.

getJavascriptIncludes ( )

returns an array of js includes needed for the current locale

Returns
void public

Definition at line 677 of file locale_manager.inc.

getLocaleName (   $locale_code = NULL)

Gets the full name of a locale

Parameters
string$locale_codethe locale code to check (if omitted, uses the current locale)
Returns
string public

Definition at line 161 of file locale_manager.inc.

getLocaleParts (   $locale)

Split a full locale into its parts

Can be called using, eg: list($country, $language, $variant) = $GLOBALS['SQ_SYSTEM']->lm->getLocaleParts('en_AU');

Parameters
string$localethe full locale
Returns
array public

Definition at line 217 of file locale_manager.inc.

getString (   $string_code)

gets a string translation

Parameters
string$string_codethe string code
Returns
string public

Definition at line 295 of file locale_manager.inc.

includeAssetStrings (   $type_code,
  $locale = NULL 
)

Includes the compiled strings for a specified asset, if they haven't already

Parameters
string$type_codethe type code to include strings for
string$localethe locale to use (default to current)
Returns
void public

Definition at line 327 of file locale_manager.inc.

includeCoreStrings (   $locale = NULL)

Include the system-wide core strings, if they haven't already

Parameters
string$localethe locale to include (default to current locale)
Returns
void public

Definition at line 457 of file locale_manager.inc.

includePackageStrings (   $package_name,
  $locale = NULL 
)

Includes the strings from a package, if they haven't already

Parameters
string$package_namethe name of the package
string$localethe locale to use (default = current)
Returns
void public

Definition at line 390 of file locale_manager.inc.

raiseError (   $code,
  $error_level 
)

fetches an error translation for the current locale and triggers the error

This differs from the getErrorMessage() method in that this actually calls trigger_error() as well. Use the raw getErrorMessage() where error handling needs to differ () Shortcut defined in general.inc: trigger_localised_error()

Parameters
string$codethe error code
int$error_levelthe PHP error level (must be one of: E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE)
Returns
void public

Definition at line 527 of file locale_manager.inc.

restoreCurrentLocale ( )

Restore the previously set locale from the top of the stack

Returns
boolean public

Definition at line 196 of file locale_manager.inc.

setCurrentLocale (   $locale)

Sets the current locale, loading the language files if that is required

Parameters
string$localethe locale to set
Returns
boolean public

Definition at line 180 of file locale_manager.inc.


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