Hello,
I am using CI for a few years now (love it, BTW), and every now and then I get stuck with a problem I cannot seem to solve.
This time I am trying to load language files but to no avail.
My controller looks like this:
if ( ! defined('BASEPATH')) exit ('No direct script access allowed');
class Switch_lang extends CI_Controller {
function __construct(){
parent:: __construct();
}
public function index()
{
if($this->session->userdata('lang')== 'heb'){ // switch to English
$this->session->set_userdata('lang', 'eng');
$this->session->set_userdata('switch_to_lang', 'עבר');
$this->lang->load('english','english');
$this->session->set_userdata('lang_load', 'english');
}else{
$this->session->set_userdata('lang', 'heb'); // switch to Hebrew
$this->session->set_userdata('switch_to_lang', 'Eng');
$this->lang->load('hebrew','hebrew');
$this->session->set_userdata('lang_load', 'hebrew');
}
redirect(base_url());
}
}
Nothing happens.
The only way to see a language is when I autoload through config/autoload.php file, and even then only english works!
My language folder looks like this:
application
>language
>english
>english_lang.php
>hebrew
>hebrew_lang.php
inside the files the phrases go like this:
<?php
/* Galley page */
$lang['gallery_header'] = 'Gallery';
$lang['food_gallery_header'] = 'Food Gallery';
Langage helper is auto-loaded also.
What gives?
Thanks, Eyal