Class: I2CE Locales: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 19: Line 19:
*Signature: static public function ensureSelectableLocale($locale,$fallback_site_preferred)
*Signature: static public function ensureSelectableLocale($locale,$fallback_site_preferred)
*Parameters:
*Parameters:
*$locale  
**$locale  
*$fallback_site_preferred  
**$fallback_site_preferred  
***Default Value: true
***Default Value: true
===ensureValidResolution()===
===ensureValidResolution()===
*Signature: static public function ensureValidResolution($locale,$resolution)
*Signature: static public function ensureValidResolution($locale,$resolution)
*Parameters:
*Parameters:
*$locale  
**$locale  
*$resolution  
**$resolution  
===getAvailableLocales()===
===getAvailableLocales()===
Get all locales that are either selectable or referenced in the reosltuion of a selectable locale
Get all locales that are either selectable or referenced in the reosltuion of a selectable locale
Line 42: Line 42:
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $locale
** [http://www.php.net/manual/en/language.types.string.php string ] $locale
*$ensure_selectable  
**$ensure_selectable  
***Default Value: false
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string;
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string;
Line 62: Line 62:
*Signature: static public function isSetPreferredLocale($locale)
*Signature: static public function isSetPreferredLocale($locale)
*Parameters:
*Parameters:
*$locale  
**$locale  
***Default Value: null
***Default Value: null
===isSetPreferredLocales()===
===isSetPreferredLocales()===
Line 70: Line 70:
*Signature: static public function mapLanguageToLocale($locale)
*Signature: static public function mapLanguageToLocale($locale)
*Parameters:
*Parameters:
*$locale  
**$locale  
*Returns: mixed.<br/>false on failure. string on success
*Returns: mixed.<br/>false on failure. string on success
===setPreferredLocale()===
===setPreferredLocale()===
Line 81: Line 81:
*Signature: static protected function setPreferredLocales($locales)
*Signature: static protected function setPreferredLocales($locales)
*Parameters:
*Parameters:
*$locales  
**$locales  
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string, the locales that were set.
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string, the locales that were set.
===setSitePreferredLocale()===
===setSitePreferredLocale()===
*Signature: static public function setSitePreferredLocale($locale)
*Signature: static public function setSitePreferredLocale($locale)
*Parameters:
*Parameters:
*$locale  
**$locale  
===validateLocales()===
===validateLocales()===
*Signature: static public function validateLocales($locales)
*Signature: static public function validateLocales($locales)
*Parameters:
*Parameters:
*$locales  
**$locales  




[[Category:Class Documentation]]
[[Category:Class Documentation]]

Revision as of 12:08, 17 October 2009

This article desrcibes the class I2CE_Locales.

I2CE_Locales @todo Better Documentation

Constants

I2CE_Locales::DEFAULT_LOCALE

The 'defualt' locale for I2CE. You should not need to change this unless you are doing something crazy.

@var string DEFAULT_LOCALE

Defined as: 'en_US'

Variables

$request_locale

  • Type: static protected $request_locale

$preferred_locale

  • Type: static protected $preferred_locale

Methods

ensureSelectableLocale()

  • Signature: static public function ensureSelectableLocale($locale,$fallback_site_preferred)
  • Parameters:
    • $locale
    • $fallback_site_preferred
      • Default Value: true

ensureValidResolution()

  • Signature: static public function ensureValidResolution($locale,$resolution)
  • Parameters:
    • $locale
    • $resolution

getAvailableLocales()

Get all locales that are either selectable or referenced in the reosltuion of a selectable locale

  • Signature: static public function getAvailableLocales()
  • Returns: array
    of string, the locales

getBrowserPreferredLocale()

  • Signature: static public function getBrowserPreferredLocale()

getBrowserPrefferedLocales()

Get the locales that were requested by the browser in order of decreasing preferrence. @param boolean $validate. Defaults to true

  • Signature: static public function getBrowserPrefferedLocales()
  • Returns: array
    of string

getLocaleResolution()

Gets the resolution of search paths for a locale

  • Signature: static public function getLocaleResolution($locale,$ensure_selectable)
  • Parameters:
    • string $locale
    • $ensure_selectable
      • Default Value: false
  • Returns: array
    of string;

getPreferredLocale()

Get the preferred locale. Checks against the selectable locales

  • Signature: static public function getPreferredLocale()
  • Returns: string
    $locale

getPreferredLocales()

Get the preffered locales in order of decreasing preference

  • Signature: static public function getPreferredLocales()
  • Returns: array
    of string. The prefferend locales e.g. array('fr_FR','en_GB','en_US')

getSelectableLocales()

Get a list of the selectable locales for the site.. i.e. the locales that we know something about. This should not be a big list.

  • Signature: static public function getSelectableLocales()
  • Returns: array
    of string

getSitePreferredLocale()

  • Signature: static public function getSitePreferredLocale()

isSetPreferredLocale()

  • Signature: static public function isSetPreferredLocale($locale)
  • Parameters:
    • $locale
      • Default Value: null

isSetPreferredLocales()

  • Signature: static protected function isSetPreferredLocales()

mapLanguageToLocale()

attempt to map a language to a locale based on the selectable locales

  • Signature: static public function mapLanguageToLocale($locale)
  • Parameters:
    • $locale
  • Returns: mixed.
    false on failure. string on success

setPreferredLocale()

Set the preferred locale. Checks against the selectable locales

  • Signature: static public function setPreferredLocale($locale)
  • Parameters:

setPreferredLocales()

Validates and sets the preferred locales for the session in order of decreasing preference. It makes sure that self::DEFAULT_LOCALE is in the list of preferred locales. @param mixed @locales. string or array of string. The preferred locale or an array of prefered locales.

  • Signature: static protected function setPreferredLocales($locales)
  • Parameters:
    • $locales
  • Returns: array
    of string, the locales that were set.

setSitePreferredLocale()

  • Signature: static public function setSitePreferredLocale($locale)
  • Parameters:
    • $locale

validateLocales()

  • Signature: static public function validateLocales($locales)
  • Parameters:
    • $locales