check for loaded language file should be done with idiom

Issue #2664 invalid
Anonymous created an issue

for my project i needed to load a language file in multiple languages at the same time. The language entries were named like english_xyz and german_xyz. I wondered why only one language was loaded.

Then i realized that (in all versions of Codeigniter) the check for loaded language files is done without the idiom. the idiom is never empty (if string is emtpy, it is set to default), so i a better solution for function load is the following:

if ($idiom == '') { $deft_lang = ( ! isset($config['language'])) ? 'english' : $config['language']; $idiom = ($deft_lang == '') ? 'english' : $deft_lang; }

and then

if (in_array($idiom.'/'.$langfile, $this->is_loaded, TRUE)) { return; }

and at the end

$this->is_loaded[] = $idiom.'/'.$langfile;

Comments (1)

  1. Log in to comment