PHP Class Xinax\LaravelGettext\LaravelGettext

Mostrar archivo Open project: xinax/laravel-gettext Class Usage Examples

Protected Properties

Property Type Description
$translator Xinax\LaravelGettext\Translators\TranslatorInterface Translator handler

Public Methods

Method 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 method

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

getDomain() public method

Returns the current domain
public getDomain ( ) : string
return string

getEncoding() public method

Get the current encoding
public getEncoding ( ) : string
return string

getLocale() public method

Gets the Current locale.
public getLocale ( ) : string
return string

getLocaleLanguage() public method

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

getSelector() public method

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

getSupportedLocales() public method

Returns supported locales
public getSupportedLocales ( ) : array
return array

getTranslator() public method

Returns the translator.
public getTranslator ( ) : Xinax\LaravelGettext\Translators\TranslatorInterface
return Xinax\LaravelGettext\Translators\TranslatorInterface

isLocaleSupported() public method

Indicates if given locale is supported
public isLocaleSupported ( $locale ) : boolean
return boolean

setDomain() public method

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

setEncoding() public method

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

setLocale() public method

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

setTranslator() public method

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

translate() public method

Translates a message with the current handler
public translate ( $message ) : string
$message
return string

translatePlural() public method

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

Property Details

$translator protected_oe property

Translator handler
protected TranslatorInterface,Xinax\LaravelGettext\Translators $translator
return Xinax\LaravelGettext\Translators\TranslatorInterface