Class jLocale

Description

static class to get a localized string

Located in /core/jLocale.class.php (line 23)


	
			
Variable Summary
static mixed $bundles
static array $langToLocale
Method Summary
static string get (string $key, [array $args = null], [string $locale = null], [string $charset = null])
static string getCorrespondingLocale ( $l, [boolean $strictCorrespondance = false], string $locale)
static string getCurrentCountry ()
static string getCurrentLang ()
static string getPreferedLocaleFromRequest ()
static string langToLocale (string $lang)
Variables
static mixed $bundles = array() (line 27)
static array $langToLocale = null (line 168)
  • var: content of the lang_to_locale.ini.php
  • access: protected
Methods
static get (line 62)

gets the correct string, for a given language.

if it can't get the correct language, it will try to gets the string from the default language. if both fails, it will raise an exception.

  • return: the localized string
static string get (string $key, [array $args = null], [string $locale = null], [string $charset = null])
  • string $key: the key of the localized string
  • array $args: arguments to apply to the localized string with sprintf
  • string $locale: the lang code. if null, use the default language
  • string $charset: the charset code. if null, use the default charset
static getCorrespondingLocale (line 121)

says if the given locale or lang code is available in the application

  • return: the corresponding locale
static string getCorrespondingLocale ( $l, [boolean $strictCorrespondance = false], string $locale)
  • string $locale: the locale code (xx_YY) or a lang code (xx)
  • boolean $strictCorrespondance: if true don't try to find a locale from an other country
  • $l
static getCurrentCountry (line 46)

gets the current country.

static string getCurrentCountry ()
static getCurrentLang (line 38)

gets the current lang

static string getCurrentLang ()
static getPreferedLocaleFromRequest (line 147)

returns the locale corresponding of one of the accepted language indicated by the browser, and which is available in the application.

  • return: the locale. empty if not found.
static string getPreferedLocaleFromRequest ()
static langToLocale (line 178)

returns the locale corresponding to a lang.

The file lang_to_locale give corresponding locale, but you can override these association into the langToLocale section of the main configuration

  • return: the corresponding locale (xx_YY)
static string langToLocale (string $lang)
  • string $lang: a lang code (xx)

Documentation generated on Mon, 26 Oct 2015 21:55:03 +0100 by phpDocumentor 1.4.3