Noherczeg\Breadcrumb\Translator::loadDictionary PHP Method

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
    public function loadDictionary($lang = null)
    {
        if (!is_string($lang) && !is_null($lang)) {
            throw new \InvalidArgumentException("Please provide a string as parameter!");
        } else {
            // if nothing is set, get it from the config file
            if (is_null($lang)) {
                $lang = $this->config->value('language');
            }
            $file_to_load = $this->language_folder . $lang . '.php';
            return $this->loadFile($file_to_load);
        }
    }

Usage Example

Example #1
0
 public function testGeneric()
 {
     $this->tran->loadDictionary();
 }