PHP Class Noherczeg\Breadcrumb\Translator

The sole job of this class is to properly translate (or not) the given value according to the configurations.
Show file Open project: noherczeg/breadcrumb Class Usage Examples

Public Methods

Method Description
__construct ( String $config = null ) Constructor
dump ( ) : array dump: Dumps the contents of the Dictionary.
loadDictionary ( String $lang = null ) : array loadDictionary: loads a language array from the Language folder.
loadFile ( String $file_to_load = null ) : array loadFile: yeah, well, separated due to testing purposes :(
translate ( String $key ) : String translate: Fetches a value from the Ditionary with an index provided.

Private Methods

Method Description
initDictionary ( $config )

Method Details

__construct() public method

Constructor
public __construct ( String $config = null )
$config String The code(file name in the Languages folder), or an array of key-value pairs of the language to use for translations

dump() public method

dump: Dumps the contents of the Dictionary.
public dump ( ) : array
return array

loadDictionary() public method

loadDictionary: loads a language array from the Language folder.
public loadDictionary ( String $lang = null ) : array
$lang String Selected language's code e.g. 'en'
return array

loadFile() public method

loadFile: yeah, well, separated due to testing purposes :(
public loadFile ( String $file_to_load = null ) : array
$file_to_load String Language file's name
return array

translate() public method

translate: Fetches a value from the Ditionary with an index provided.
public translate ( String $key ) : String
$key String Parameter which we want to translate
return String