CodeIgniter Forums
Calendar library lang file loader issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Calendar library lang file loader issue (/showthread.php?tid=1552)



Calendar library lang file loader issue - Arcane - 03-20-2015

Hello everyone,

I had to use a translation for the Calendar library and I realized that this piece of code is actually not working well for me:
Code:
if ( ! in_array('calendar_lang.php', $this->CI->lang->is_loaded, TRUE))
{
$this->CI->lang->load('calendar');
}

Indeed, the content of lang->is_loaded is an array in which calendar_lang.php is a key:
Code:
array(2) { ["calendar_lang.php"]=> string(6) "french" ["trad_lang.php"]=> string(6) "french" }

Therefore, I suggest changing the code to:
Code:
if (! array_key_exists ( 'calendar_lang.php', $this->CI->lang->is_loaded ))
{
$this->CI->lang->load ( 'calendar' );
}



RE: Calendar library lang file loader issue - includebeer - 03-20-2015

Once a language file is loaded, you can't load it again in another language. If that's what you are trying to do...


RE: Calendar library lang file loader issue - Arcane - 03-23-2015

No, not at all, I think you got me wrong.
I was simply stating that the piece of code checking if calendar_lang has been already loaded is not working properly.
In my case, I load all _lang file depending on user's favorite language.
The actual code is not checking properly and reloads the calendar_lang file with the default language set in config.php


RE: Calendar library lang file loader issue - gadelat - 03-23-2015

He is talking about this piece of Calendar code in base framework


RE: Calendar library lang file loader issue - Arcane - 03-24-2015

(03-23-2015, 05:21 AM)gadelat Wrote: He is talking about this piece of Calendar code in base framework

That's right, thanks for the direct link Wink


RE: Calendar library lang file loader issue - gadelat - 03-26-2015

This is confirmed as CI bug and will be fixed in final 3.0 release.