jLocale

static class to get a localized string

package

jelix

subpackage

core

Methods

static class.

__construct() 

..

gets the correct string, for a given language.

get(string $key, array $args = null, string $locale = null, string $charset = null) : string
static

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.

Throws
\Exception
\jExceptionSelector

Arguments

$key

string

the key of the localized string

$args

array

arguments to apply to the localized string with sprintf

$locale

string

the lang code. if null, use the default language

$charset

string

the charset code. if null, use the default charset

Response

string

the localized string

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

getCorrespondingLocale( $l, boolean $strictCorrespondance = false) : string
static

Arguments

$l

$strictCorrespondance

boolean

if true don't try to find a locale from an other country

Response

string

the corresponding locale

gets the current country.

getCurrentCountry() : string
static

Response

string

gets the current lang

getCurrentLang() : string
static

Response

string

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

getPreferedLocaleFromRequest() : string
static

Response

string

the locale. empty if not found.

returns the locale corresponding to a lang.

langToLocale(string $lang) : string
static

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

Arguments

$lang

string

a lang code (xx)

Response

string

the corresponding locale (xx_YY)

Properties

bundles

bundles : array<mixed,\jBundle[]>
static
var

Type(s)

array<mixed,\jBundle[]>

content of the lang_to_locale.ini.php

langToLocale : array
static
var

content of the lang_to_locale.ini.php

Type(s)

array