jLocale
    
            
            in package
            
        
    
    
    
        
            static class to get a localized string.
Tags
Table of Contents
- $bundles : array<string|int, array<string|int, jBundle>>
 - $langNames : array<string|int, array<string|int, string>>
 - $langToLocale : array<string|int, mixed>
 - get() : string
 - gets the correct string, for a given language.
 - getAlternativeLocales() : array<string|int, mixed>
 - return the list of alternative locales to the given one.
 - getCorrespondingLocale() : string
 - says if the given locale or lang code is available in the application.
 - getCurrentCountry() : string
 - gets the current country (YY from xx_YY).
 - getCurrentLang() : string
 - gets the current lang (xx from xx_YY).
 - getCurrentLocale() : string
 - gets the current locale (xx_YY).
 - getLangName() : mixed
 - getPreferedLocaleFromRequest() : string
 - returns the locale corresponding of one of the accepted language indicated by the browser, and which is available in the application.
 - langToLocale() : string
 - returns the locale corresponding to a lang.
 - tryOtherLocales() : mixed
 - __construct() : mixed
 - static class.
 
Properties
$bundles
    public
    static    array<string|int, array<string|int, jBundle>>
    $bundles
     = array()
    
    
    
$langNames
    protected
    static    array<string|int, array<string|int, string>>
    $langNames
     = array()
    
        first key is lang code of translation of names, second key is lang code
$langToLocale
    protected
    static    array<string|int, mixed>
    $langToLocale
    
    
        content of the lang_to_locale.ini.php
Methods
get()
gets the correct string, for a given language.
    public
            static    get(string $key[, array<string|int, mixed> $args = null ][, string $locale = null ][, string $charset = null ][, bool $tryOtherLocales = true ]) : string
        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.
Parameters
- $key : string
 - 
                    
the key of the localized string
 - $args : array<string|int, mixed> = null
 - 
                    
arguments to apply to the localized string with sprintf
 - $locale : string = null
 - 
                    
the lang code. if null, use the default language
 - $charset : string = null
 - 
                    
the charset code. if null, use the default charset
 - $tryOtherLocales : bool = true
 - 
                    
if true and if the method does not find the locale file or the key, it will try with the default locale, the fallback local or similar locale
 
Tags
Return values
string —the localized string
getAlternativeLocales()
return the list of alternative locales to the given one.
    public
            static    getAlternativeLocales(string $locale, object $config) : array<string|int, mixed>
    
        Parameters
- $locale : string
 - $config : object
 - 
                    
the configuration object
 
Return values
array<string|int, mixed> —getCorrespondingLocale()
says if the given locale or lang code is available in the application.
    public
            static    getCorrespondingLocale(mixed $l[, bool $strictCorrespondance = false ]) : string
    
        Parameters
- $l : mixed
 - $strictCorrespondance : bool = false
 - 
                    
if true don't try to find a locale from an other country
 
Return values
string —the corresponding locale
getCurrentCountry()
gets the current country (YY from xx_YY).
    public
            static    getCurrentCountry() : string
    
    
    
        Return values
string —getCurrentLang()
gets the current lang (xx from xx_YY).
    public
            static    getCurrentLang() : string
    
    
    
        Return values
string —getCurrentLocale()
gets the current locale (xx_YY).
    public
            static    getCurrentLocale() : string
    
    
    
    Tags
Return values
string —getLangName()
    public
            static    getLangName(string $lang[, string $langOfName = '' ]) : mixed
    
        Parameters
- $lang : string
 - 
                    
the lang for which we want the name
 - $langOfName : string = ''
 - 
                    
if empty, return the name in its own language
 
Tags
Return values
mixed —getPreferedLocaleFromRequest()
returns the locale corresponding of one of the accepted language indicated by the browser, and which is available in the application.
    public
            static    getPreferedLocaleFromRequest() : string
    
    
    
        Return values
string —the locale. empty if not found.
langToLocale()
returns the locale corresponding to a lang.
    public
            static    langToLocale(string $lang) : string
        The file lang_to_locale gives corresponding locales, but you can override these association into the langToLocale section of the main configuration
Parameters
- $lang : string
 - 
                    
a lang code (xx)
 
Return values
string —the corresponding locale (xx_YY)
tryOtherLocales()
    protected
            static    tryOtherLocales(mixed $key, mixed $args, mixed $locale, mixed $charset, mixed $config) : mixed
        
        Parameters
- $key : mixed
 - $args : mixed
 - $locale : mixed
 - $charset : mixed
 - $config : mixed
 
Return values
mixed —__construct()
static class.
    private
                __construct() : mixed
        ..
