PHP Class Xinax\LaravelGettext\LaravelGettext

Afficher le fichier Open project: xinax/laravel-gettext Class Usage Examples

Protected Properties

Свойство Type Description
$translator Xinax\LaravelGettext\Translators\TranslatorInterface Translator handler

Méthodes publiques

Méthode Description
__construct ( Xinax\LaravelGettext\Translators\TranslatorInterface $gettext )
getDomain ( ) : string Returns the current domain
getEncoding ( ) : string Get the current encoding
getLocale ( ) : string Gets the Current locale.
getLocaleLanguage ( string | null $locale = null ) : string | null Get the language portion of the locale (ex. en_GB returns en)
getSelector ( array $labels = [] ) : LanguageSelector Get the language selector object
getSupportedLocales ( ) : array Returns supported locales
getTranslator ( ) : Xinax\LaravelGettext\Translators\TranslatorInterface Returns the translator.
isLocaleSupported ( $locale ) : boolean Indicates if given locale is supported
setDomain ( string $domain ) Sets the current domain
setEncoding ( string $encoding ) Set the current encoding
setLocale ( string $locale ) Set current locale
setTranslator ( Xinax\LaravelGettext\Translators\TranslatorInterface $translator ) Sets the translator
translate ( $message ) : string Translates a message with the current handler
translatePlural ( $singular, $plural, $count ) : string Translates a plural string with the current handler

Method Details

__construct() public méthode

public __construct ( Xinax\LaravelGettext\Translators\TranslatorInterface $gettext )
$gettext Xinax\LaravelGettext\Translators\TranslatorInterface

getDomain() public méthode

Returns the current domain
public getDomain ( ) : string
Résultat string

getEncoding() public méthode

Get the current encoding
public getEncoding ( ) : string
Résultat string

getLocale() public méthode

Gets the Current locale.
public getLocale ( ) : string
Résultat string

getLocaleLanguage() public méthode

Get the language portion of the locale (ex. en_GB returns en)
public getLocaleLanguage ( string | null $locale = null ) : string | null
$locale string | null
Résultat string | null

getSelector() public méthode

Get the language selector object
public getSelector ( array $labels = [] ) : LanguageSelector
$labels array
Résultat Xinax\LaravelGettext\Composers\LanguageSelector

getSupportedLocales() public méthode

Returns supported locales
public getSupportedLocales ( ) : array
Résultat array

getTranslator() public méthode

Returns the translator.
public getTranslator ( ) : Xinax\LaravelGettext\Translators\TranslatorInterface
Résultat Xinax\LaravelGettext\Translators\TranslatorInterface

isLocaleSupported() public méthode

Indicates if given locale is supported
public isLocaleSupported ( $locale ) : boolean
Résultat boolean

setDomain() public méthode

Sets the current domain
public setDomain ( string $domain )
$domain string

setEncoding() public méthode

Set the current encoding
public setEncoding ( string $encoding )
$encoding string

setLocale() public méthode

Set current locale
public setLocale ( string $locale )
$locale string

setTranslator() public méthode

Sets the translator
public setTranslator ( Xinax\LaravelGettext\Translators\TranslatorInterface $translator )
$translator Xinax\LaravelGettext\Translators\TranslatorInterface

translate() public méthode

Translates a message with the current handler
public translate ( $message ) : string
$message
Résultat string

translatePlural() public méthode

Translates a plural string with the current handler
public translatePlural ( $singular, $plural, $count ) : string
$singular
$plural
$count
Résultat string

Property Details

$translator protected_oe property

Translator handler
protected TranslatorInterface,Xinax\LaravelGettext\Translators $translator
Résultat Xinax\LaravelGettext\Translators\TranslatorInterface