Welcome Guest, Not a member yet? Register   Sign In
Calendar library lang file loader issue
#1

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' );
}
Reply
#2

Once a language file is loaded, you can't load it again in another language. If that's what you are trying to do...
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

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
Reply
#4

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

(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
Reply
#6

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




Theme © iAndrew 2016 - Forum software by © MyBB