Class: I2CE Locales

From IHRIS Wiki
Revision as of 20:24, 16 October 2009 by Litlfred (talk | contribs)

This article desrcibes the class I2CE_Locales It is contained in the module I2CE in the package I2CE

The class is defined in the file: lib/I2CE_Locales.php

I2CE_Locales

@package I2CE

@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)
  • Returns: array of string;

Parameters:

  • string $locale
  • $ensure_selectable
    • Default Value: false

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)
  • Returns: mixed. false on failure. string on success

Parameters:

  • $locale

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)
  • Returns: array of string, the locales that were set.

Parameters:

  • $locales

setSitePreferredLocale()

  • Signature: static public function setSitePreferredLocale($locale)

Parameters:

  • $locale

validateLocales()

  • Signature: static public function validateLocales($locales)

Parameters:

  • $locales