PHP Class Polyglot\Services\Lang

Inheritance: extends Illuminate\Translation\Translator
Afficher le fichier Open project: anahkiasen/polyglot

Protected Properties

Свойство Type Description
$app Illuminate\Container\Container The IoC Container
$domain string The translation domain
$encoding string The localization encoding

Méthodes publiques

Méthode Description
__construct ( Illuminate\Container\Container $app ) Build the language class
active ( string $locale ) : boolean Whether a given language is the current one
defaultLocale ( ) : string Get the default locale
fallbackLocale ( ) : string Get the fallback locale
get ( string $key, array $replace = [], string $locale = null ) : string Get the translation for the given key, or fallback to fallback locale
getAvailable ( ) : array Get all available languages
getDomain ( ) : string Get the translation domain
getEncoding ( boolean $slug = false ) : string Get the encoding
getInternalLocale ( ) : string Get the internal locale
getLocaleFolder ( string $locale ) : string Get the folder where a locale's translations reside
getShortInternalLocale ( ) : string Get the short version of the internal locale
getTranslationsFolder ( string $subfolder = null ) : string Get the folder where the translations reside
sanitize ( string $locale = null ) : string Sanitize a locale
setInternalLocale ( string | boolean $locale = false ) : string Sets the locale according to the current language
setLocale ( string $locale ) : string Change the current language
shortToLongLocale ( string $locale ) : string Translate a short locale to long (en => en_US)
valid ( string $locale ) : boolean Check whether a language is valid or not

Method Details

__construct() public méthode

Build the language class
public __construct ( Illuminate\Container\Container $app )
$app Illuminate\Container\Container

active() public méthode

Whether a given language is the current one
public active ( string $locale ) : boolean
$locale string The language to check
Résultat boolean

defaultLocale() public méthode

Get the default locale
public defaultLocale ( ) : string
Résultat string

fallbackLocale() public méthode

Get the fallback locale
public fallbackLocale ( ) : string
Résultat string

get() public méthode

Get the translation for the given key, or fallback to fallback locale
public get ( string $key, array $replace = [], string $locale = null ) : string
$key string
$replace array
$locale string
Résultat string

getAvailable() public méthode

Get all available languages
public getAvailable ( ) : array
Résultat array An array of languages

getDomain() public méthode

Get the translation domain
public getDomain ( ) : string
Résultat string

getEncoding() public méthode

Get the encoding
public getEncoding ( boolean $slug = false ) : string
$slug boolean
Résultat string

getInternalLocale() public méthode

Get the internal locale
public getInternalLocale ( ) : string
Résultat string

getLocaleFolder() public méthode

Get the folder where a locale's translations reside
public getLocaleFolder ( string $locale ) : string
$locale string
Résultat string

getShortInternalLocale() public méthode

Get the short version of the internal locale
public getShortInternalLocale ( ) : string
Résultat string

getTranslationsFolder() public méthode

Get the folder where the translations reside
public getTranslationsFolder ( string $subfolder = null ) : string
$subfolder string
Résultat string

sanitize() public méthode

Sanitize a locale
public sanitize ( string $locale = null ) : string
$locale string
Résultat string

setInternalLocale() public méthode

Sets the locale according to the current language
public setInternalLocale ( string | boolean $locale = false ) : string
$locale string | boolean A language string to use
Résultat string

setLocale() public méthode

Change the current language
public setLocale ( string $locale ) : string
$locale string The language to change to
Résultat string

shortToLongLocale() public méthode

Translate a short locale to long (en => en_US)
public shortToLongLocale ( string $locale ) : string
$locale string
Résultat string

valid() public méthode

Check whether a language is valid or not
public valid ( string $locale ) : boolean
$locale string The language
Résultat boolean

Property Details

$app protected_oe property

The IoC Container
protected Container,Illuminate\Container $app
Résultat Illuminate\Container\Container

$domain protected_oe property

The translation domain
protected string $domain
Résultat string

$encoding protected_oe property

The localization encoding
protected string $encoding
Résultat string