PHP Class Lang, someline-starter

Show file Open project: someline/someline-starter Class Usage Examples

Public Methods

Method Description
addNamespace ( string $namespace, string $hint ) : void Add a new namespace to the loader.
choice ( string $key, integer | array | Countable $number, array $replace = [], string $locale = null ) : string Get a translation according to an integer value.
get ( string $key, array $replace = [], string | null $locale = null, boolean $fallback = true ) : string | array | null Get the translation for the given key.
getFallback ( ) : string Get the fallback locale being used.
getLoader ( ) : Illuminate\Translation\LoaderInterface Get the language line loader implementation.
getLocale ( ) : string Get the default locale being used.
getSelector ( ) : Symfony\Component\Translation\MessageSelector Get the message selector instance.
has ( string $key, string | null $locale = null, boolean $fallback = true ) : boolean Determine if a translation exists.
hasForLocale ( string $key, string | null $locale = null ) : boolean Determine if a translation exists for a given locale.
load ( string $namespace, string $group, string $locale ) : void Load the specified language group.
locale ( ) : string Get the default locale being used.
parseKey ( string $key ) : array Parse a key into namespace, group, and item.
setFallback ( string $fallback ) : void Set the fallback locale being used.
setLocale ( string $locale ) : void Set the default locale.
setParsedKey ( string $key, array $parsed ) : void Set the parsed value of a key.
setSelector ( Symfony\Component\Translation\MessageSelector $selector ) : void Set the message selector instance.
trans ( string $id, array $parameters = [], string $domain = 'messages', string $locale = null ) : string | array | null Get the translation for a given key.
transChoice ( string $id, integer | array | Countable $number, array $parameters = [], string $domain = 'messages', string $locale = null ) : string Get a translation according to an integer value.

Method Details

addNamespace() public static method

Add a new namespace to the loader.
public static addNamespace ( string $namespace, string $hint ) : void
$namespace string
$hint string
return void

choice() public static method

Get a translation according to an integer value.
public static choice ( string $key, integer | array | Countable $number, array $replace = [], string $locale = null ) : string
$key string
$number integer | array | Countable
$replace array
$locale string
return string

get() public static method

Get the translation for the given key.
public static get ( string $key, array $replace = [], string | null $locale = null, boolean $fallback = true ) : string | array | null
$key string
$replace array
$locale string | null
$fallback boolean
return string | array | null

getFallback() public static method

Get the fallback locale being used.
public static getFallback ( ) : string
return string

getLoader() public static method

Get the language line loader implementation.
public static getLoader ( ) : Illuminate\Translation\LoaderInterface
return Illuminate\Translation\LoaderInterface

getLocale() public static method

Get the default locale being used.
public static getLocale ( ) : string
return string

getSelector() public static method

Get the message selector instance.
public static getSelector ( ) : Symfony\Component\Translation\MessageSelector
return Symfony\Component\Translation\MessageSelector

has() public static method

Determine if a translation exists.
public static has ( string $key, string | null $locale = null, boolean $fallback = true ) : boolean
$key string
$locale string | null
$fallback boolean
return boolean

hasForLocale() public static method

Determine if a translation exists for a given locale.
public static hasForLocale ( string $key, string | null $locale = null ) : boolean
$key string
$locale string | null
return boolean

load() public static method

Load the specified language group.
public static load ( string $namespace, string $group, string $locale ) : void
$namespace string
$group string
$locale string
return void

locale() public static method

Get the default locale being used.
public static locale ( ) : string
return string

parseKey() public static method

Parse a key into namespace, group, and item.
public static parseKey ( string $key ) : array
$key string
return array

setFallback() public static method

Set the fallback locale being used.
public static setFallback ( string $fallback ) : void
$fallback string
return void

setLocale() public static method

Set the default locale.
public static setLocale ( string $locale ) : void
$locale string
return void

setParsedKey() public static method

Set the parsed value of a key.
public static setParsedKey ( string $key, array $parsed ) : void
$key string
$parsed array
return void

setSelector() public static method

Set the message selector instance.
public static setSelector ( Symfony\Component\Translation\MessageSelector $selector ) : void
$selector Symfony\Component\Translation\MessageSelector
return void

trans() public static method

Get the translation for a given key.
public static trans ( string $id, array $parameters = [], string $domain = 'messages', string $locale = null ) : string | array | null
$id string
$parameters array
$domain string
$locale string
return string | array | null

transChoice() public static method

Get a translation according to an integer value.
public static transChoice ( string $id, integer | array | Countable $number, array $parameters = [], string $domain = 'messages', string $locale = null ) : string
$id string
$number integer | array | Countable
$parameters array
$domain string
$locale string
return string