Class: I2CE Locales (Development)

From IHRIS Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


This article describes 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

$preferred_locale

Methods

ensureSelectableLocale()

  • Defined in i2ce/lib/I2CE_Locales.php on line 84
  • Signature: static public function ensureSelectableLocale($locale,$fallback_site_preferred)
  • Parameters:
    • $locale
    • $fallback_site_preferred
      • Default Value: true

ensureValidResolution()

  • Defined in i2ce/lib/I2CE_Locales.php on line 334
  • 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

getBrowserPreferredLocale()

getBrowserPrefferedLocales()

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

getLocaleResolution()

Gets the resolution of search paths for a locale

  • Defined in i2ce/lib/I2CE_Locales.php on line 318
  • 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

getPreferredLocales()

Get the preffered locales in order of decreasing preference

  • Defined in i2ce/lib/I2CE_Locales.php on line 66
  • 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.

getSitePreferredLocale()

isSetPreferredLocale()

  • Defined in i2ce/lib/I2CE_Locales.php on line 101
  • Signature: static public function isSetPreferredLocale($locale)
  • Parameters:
    • $locale
      • Default Value: null

isSetPreferredLocales()

mapLanguageToLocale()

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

  • Defined in i2ce/lib/I2CE_Locales.php on line 294
  • 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

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.

  • Defined in i2ce/lib/I2CE_Locales.php on line 152
  • Signature: static protected function setPreferredLocales($locales)
  • Parameters:
    • $locales
  • Returns: array
    of string, the locales that were set.

setSitePreferredLocale()

  • Defined in i2ce/lib/I2CE_Locales.php on line 211
  • Signature: static public function setSitePreferredLocale($locale)
  • Parameters:
    • $locale

validateLocales()

  • Defined in i2ce/lib/I2CE_Locales.php on line 187
  • Signature: static public function validateLocales($locales)
  • Parameters:
    • $locales