Search code examples
phpcodeignitercalendartranslate

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... :)


Solution

  • 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);