[eluser]stef25[/eluser]
I'm having some problems getting the language class to work. I have a folder system/language/dutch in which is a file called test_lang.php
My url is: example.com/index.php/mailer/index/12345/nl
My controller is:
Code:
class Mailer extends Controller {
function index() {
//grab language from URI
$user_lang = $this->uri->segment(4);
//load corresponding language file, called 'test' in folder 'dutch' or 'english'
if($user_lang == 'nl'){
$this->lang->load('test', 'dutch');
}
elseif ($user_lang == 'en'){
$this->lang->load('test', 'english');
}
//load the language specific lines of text
$data['tab_left'] = $this->lang->line['kt_nav_tab_1'];
$data['tab_middle'] = $this->lang->line['kt_nav_tab_2'];
$data['tab_right'] = $this->lang->line['kt_nav_tab_3'];
//load the view
$this->load->view('index', $data);
}
My Dutch language file then contains:
Code:
//Navigation tabs, from left to right
$lang['kt_nav_tab_1'] = 'Dutch word 1';
$lang['kt_nav_tab_2'] = 'Dutch word 2';
$lang['kt_nav_tab_3'] = 'Dutch word 3';
Now, when i visit example.com/index.php/mailer/index/12345/nl my view loads fine, but I get errors for each of the three language elements I try to load:
Undefined property: CI_Language::$line
My view contains:
Code:
echo $data['tab_left'];
echo $data['tab_middle'];
echo $data['tab_right'];
Can anyone spot what am I missing?