PHP Class Frontend\Core\Language\Language

Show file Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
act ( string $key, boolean $fallback = true ) : string Get an action from the language-file
buildCache ( string $language, string $application ) Build the language files
err ( string $key, boolean $fallback = true ) : string Get an error from the language-file
getAction ( string $key, boolean $fallback = true ) : string Get an action from the language-file
getActions ( ) : array Get all the actions
getActiveLanguages ( ) : array Get the active languages
getBrowserLanguage ( boolean $forRedirect = true ) : string Get the preferred language by using the browser-language
getError ( string $key, boolean $fallback = true ) : string Get an error from the language-file
getErrors ( ) : array Get all the errors
getLabel ( string $key, boolean $fallback = true ) : string Get a label from the language-file
getLabels ( ) : array Get all the labels
getMessage ( string $key, boolean $fallback = true ) : string Get a message from the language-file
getMessages ( ) : array Get all the messages
getRedirectLanguages ( ) : array Get the redirect languages
lbl ( string $key, boolean $fallback = true ) : string Get a label from the language-file
msg ( string $key, boolean $fallback = true ) : string Get a message from the language-file
setLocale ( string $language = null, boolean $force = false ) Set locale

Method Details

act() public static method

Get an action from the language-file
public static act ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

buildCache() public static method

Build the language files
public static buildCache ( string $language, string $application )
$language string The language to build the locale-file for.
$application string The application to build the locale-file for.

err() public static method

Get an error from the language-file
public static err ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

getAction() public static method

Get an action from the language-file
public static getAction ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

getActions() public static method

Get all the actions
public static getActions ( ) : array
return array

getActiveLanguages() public static method

Get the active languages
public static getActiveLanguages ( ) : array
return array

getBrowserLanguage() public static method

Get the preferred language by using the browser-language
public static getBrowserLanguage ( boolean $forRedirect = true ) : string
$forRedirect boolean Only look in the languages to redirect?
return string

getError() public static method

Get an error from the language-file
public static getError ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

getErrors() public static method

Get all the errors
public static getErrors ( ) : array
return array

getLabel() public static method

Get a label from the language-file
public static getLabel ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

getLabels() public static method

Get all the labels
public static getLabels ( ) : array
return array

getMessage() public static method

Get a message from the language-file
public static getMessage ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

getMessages() public static method

Get all the messages
public static getMessages ( ) : array
return array

getRedirectLanguages() public static method

Get the redirect languages
public static getRedirectLanguages ( ) : array
return array

lbl() public static method

Get a label from the language-file
public static lbl ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

msg() public static method

Get a message from the language-file
public static msg ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string

setLocale() public static method

Set locale
public static setLocale ( string $language = null, boolean $force = false )
$language string The language to load, if not provided we will load the language based on the URL.
$force boolean Force the language, so don't check if the language is active.