[eluser]peredurabefrog[/eluser]
Hi,
I'm writing a bilingual site in CI version 2. Following the instructions in the user guide I've created language files at application/language/english/english_lang.php and application/language/welsh/welsh_lang.php. In autoload.php I've added 'english' and 'welsh' to the $autoload['language'] array:
Code:
$autoload['language'] = array('english', 'welsh');
What I want to do in my application is to test for the language the user wants and then load the correct strings for things like titles, so in english_lang.php I have, for example:
Code:
$lang['en_title_home'] = "Wales Legislation Online: Home";
And in welsh_lang.php I have:
Code:
$lang['cy_title_home'] = "Deddfwriaeth Cymru Arlein: Hafan";
The language the user wants is passed into every controller function as a parameter, for example:
Code:
function index($language = 'en') { ... }
So I'm hoping that in each function I can do something like:
Code:
if($language == 'en')
$data['title'] = $this->lang->line('en_title_home');
else
$data['title'] = $this->lang->line('cy_title_home');
However, when I try to run the application it fails with the following error:
Code:
Unable to load the requested language file: language/english/welsh_lang.php
From what I can tell, it's the autoloading that's failing, although I could be mistaken. Obviously I'm misunderstanding the user guide so if anyone could take the time to put me straight, I'd be very grateful.
Thanks in advance,
Peredur