Translate CodeIgniter's calendar to another language
I'm trying to translate CodeIgniter's calendar object to Hebrew.
I made Hebrew-calendar translation files (calender_lang.php under a 'hebrew' folder) as required and loaded the calendar (in english).
However, I don't understand how to translate the whole calender in one time. Should I use a loop for everything?
I can't understand how to use:
$this->lang->line('language_key');
开发者_运维百科
to change the language of my calendar.
I'm using:
echo $this->calendar->generate();
to show the calendar.
you quick help would be appreciated... :)
solved.
i see there is importance to the order you load your libraries.
first, load the language library. and also - load the parser library.
$this->lang->load('calendar', 'hebrew');
$this->load->library('parser');
then:
\\ $prefs is an array inculding long days preferences etc.
$this->load->library('calendar', $prefs);
$cal=$this->calendar->generate();
$dataD['calender']=$cal;
\\ app_doc_result is the wanted view
$this->parser->parse('app_doc_result',$dataD);
You may also try to load a 'new' language after loading the calendar and before generating the one. In my case it's working:
$this->load->library('calendar', $prefs);
$this->lang->load('calendar', 'language');
[...]
$this->calendar->generate();
This will replace the translation loaded during calendar load. You need to have the same array keys for your translation as they are in original lang file, simply copy it from system/language/english/calendar_lang.php
to your language location and translate.
精彩评论