Holds data about a specific locale and provides look-up methods to attempt to guess the best locale from the current browser data. Some bits of this class are taken from Zend_Locale.


public __construct([$inLocale = null])

Creates a new locale using the specified locale or searching for the most appropriate

public static cleanLocale($inLocale)

Cleans the locale so it is in a consistent format

public static getLocales()

Returns the array of locals

public static getLocaleTranslations()

Returns the array of local translations

public static translateLocaleData($inData)

Returns a translation for $inData from the self::$_LocaleTranslations

public static isValidLocale($inLocale, [$inCheckPartials = true])

Returns true if $inLocale exists in the LocaleData

If $inCheckPartials is true then the locale is checked for an under-score (_) separator that splits the language and region and the language component will be checked against the LocaleData array. e.g. en_XYZ is not valid, but $inCheckPartials set to true, will validate against 'en' meaning the locale will still be treated as being valid.

public detectLocale([$inLocale = null])

Attempts to detect the current locale from various sources

public detectBrowserLocales()

Attempts to detect the current browser locale

public detectEnvLocales()

Attempts to detect the current environment locale

public reset()

Reset object to defaults

public getLocale()

Returns the current locale, or if not set, the system default locale

public setLocale($inLocale)

Explicitly set the locale to $inLocale

public getLanguage()

Returns the language part of the locale

public getRegion()

Returns the region part of the locale if available

public toString()

Returns a string representation of the object

public __toString()

Returns a string representation of the object

public isModified()

Returns true if object has been modified

public setModified([$status = true])

Set the status of the object if it has been changed

public getDefaultLocale()

Returns the system default locale (if set)

public setDefaultLocale($inDefaultLocale)

Set $_DefaultLocale to $inDefaultLocale

public getCurrentLocale()

Returns the currently assigned locale

public setCurrentLocale($inCurrentLocale)

Set $_CurrentLocale to $inCurrentLocale

public getBrowserLocales()

Returns the array of detected browser locales

public setBrowserLocales($inBrowserLocale)

Set $_BrowserLocale to $inBrowserLocale

public getEnvLocales()

Returns the array of detected environment locales

public setEnvLocales($inEnvLocale)

Set $_EnvLocale to $inEnvLocale

public isLocaleFromAutoDetect()

Returns true if current locale came from auto-detect

public setLocaleFromAutoDetect($inLocaleFromAutoDetect)

Set $_LocaleFromAutoDetect to $inLocaleFromAutoDetect

<  1  >