PHP Класс Polyglot\Services\Lang

Наследование: extends Illuminate\Translation\Translator
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$app Illuminate\Container\Container The IoC Container
$domain string The translation domain
$encoding string The localization encoding

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

Метод Описание
__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

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

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

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

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

Whether a given language is the current one
public active ( string $locale ) : boolean
$locale string The language to check
Результат boolean

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

Get the default locale
public defaultLocale ( ) : string
Результат string

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

Get the fallback locale
public fallbackLocale ( ) : string
Результат string

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

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
Результат string

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

Get all available languages
public getAvailable ( ) : array
Результат array An array of languages

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

Get the translation domain
public getDomain ( ) : string
Результат string

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

Get the encoding
public getEncoding ( boolean $slug = false ) : string
$slug boolean
Результат string

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

Get the internal locale
public getInternalLocale ( ) : string
Результат string

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

Get the folder where a locale's translations reside
public getLocaleFolder ( string $locale ) : string
$locale string
Результат string

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

Get the short version of the internal locale
public getShortInternalLocale ( ) : string
Результат string

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

Get the folder where the translations reside
public getTranslationsFolder ( string $subfolder = null ) : string
$subfolder string
Результат string

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

Sanitize a locale
public sanitize ( string $locale = null ) : string
$locale string
Результат string

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

Sets the locale according to the current language
public setInternalLocale ( string | boolean $locale = false ) : string
$locale string | boolean A language string to use
Результат string

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

Change the current language
public setLocale ( string $locale ) : string
$locale string The language to change to
Результат string

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

Translate a short locale to long (en => en_US)
public shortToLongLocale ( string $locale ) : string
$locale string
Результат string

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

Check whether a language is valid or not
public valid ( string $locale ) : boolean
$locale string The language
Результат boolean

Описание свойств

$app защищенное свойство

The IoC Container
protected Container,Illuminate\Container $app
Результат Illuminate\Container\Container

$domain защищенное свойство

The translation domain
protected string $domain
Результат string

$encoding защищенное свойство

The localization encoding
protected string $encoding
Результат string