PHP Класс SimpleSAML\Locale\Language

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( SimpleSAML_Configuration $configuration ) Constructor
getDefaultLanguage ( ) : string Return the default language according to configuration.
getLanguage ( ) : string This method will return the language selected by the user, or the default language. It looks first for a cached language code, then checks for a language cookie, then it tries to calculate the preferred language from HTTP headers.
getLanguageCodeAlias ( $langcode ) : string Return an alias for a langcode, if any
getLanguageCookie ( ) : string | null Retrieve the user-selected language from a cookie.
getLanguageList ( ) : array Return an indexed list of all languages available.
getLanguageLocalizedName ( string $code ) : string Get the localized name of a language, by ISO 639-2 code.
getLanguageParameterName ( ) : string Get the language parameter name.
getPosixLanguage ( $language ) * Rename to non-idiosyncratic language code
isLanguageRTL ( ) : boolean Check whether a language is written from the right to the left or not.
setLanguage ( string $language, boolean $setLanguageCookie = true ) This method will set a cookie for the user's browser to remember what language was selected.
setLanguageCookie ( string $language ) This method will attempt to set the user-selected language in a cookie. It will do nothing if the language specified is not in the list of available languages, or the headers have already been sent to the browser.

Приватные методы

Метод Описание
getHTTPLanguage ( ) : string This method returns the preferred language for the user based on the Accept-Language HTTP header.
getInstalledLanguages ( ) : array Wash configured (available) languages against installed languages

Описание методов

__construct() публичный Метод

Constructor
public __construct ( SimpleSAML_Configuration $configuration )
$configuration SimpleSAML_Configuration Configuration object

getDefaultLanguage() публичный Метод

Return the default language according to configuration.
public getDefaultLanguage ( ) : string
Результат string The default language that has been configured. Defaults to english if not configured.

getLanguage() публичный Метод

This method will return the language selected by the user, or the default language. It looks first for a cached language code, then checks for a language cookie, then it tries to calculate the preferred language from HTTP headers.
public getLanguage ( ) : string
Результат string The language selected by the user according to the processing rules specified, or the default language in any other case.

getLanguageCodeAlias() публичный Метод

Return an alias for a langcode, if any
public getLanguageCodeAlias ( $langcode ) : string
Результат string The alias, or null if alias not found

getLanguageCookie() публичный статический Метод

Retrieve the user-selected language from a cookie.
public static getLanguageCookie ( ) : string | null
Результат string | null The selected language or null if unset.

getLanguageList() публичный Метод

Return an indexed list of all languages available.
public getLanguageList ( ) : array
Результат array An array holding all the languages available as the keys of the array. The value for each key is true in case that the language specified by that key is currently active, or false otherwise.

getLanguageLocalizedName() публичный Метод

Get the localized name of a language, by ISO 639-2 code.
public getLanguageLocalizedName ( string $code ) : string
$code string The ISO 639-2 code of the language.
Результат string The localized name of the language.

getLanguageParameterName() публичный Метод

Get the language parameter name.
public getLanguageParameterName ( ) : string
Результат string The language parameter name.

getPosixLanguage() публичный Метод

* Rename to non-idiosyncratic language code
public getPosixLanguage ( $language )
$language Language code for the language to rename, if neccesary.

isLanguageRTL() публичный Метод

Check whether a language is written from the right to the left or not.
public isLanguageRTL ( ) : boolean
Результат boolean True if the language is right-to-left, false otherwise.

setLanguage() публичный Метод

This method will set a cookie for the user's browser to remember what language was selected.
public setLanguage ( string $language, boolean $setLanguageCookie = true )
$language string Language code for the language to set.
$setLanguageCookie boolean Whether to set the language cookie or not. Defaults to true.

setLanguageCookie() публичный статический Метод

This method will attempt to set the user-selected language in a cookie. It will do nothing if the language specified is not in the list of available languages, or the headers have already been sent to the browser.
public static setLanguageCookie ( string $language )
$language string The language set by the user.