• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switching Languages

#1
[eluser]Brahm[/eluser]
Hi Folks,

In my config file I am using this:

$config['language'] = "portugues";

I want to switch to english language in my controller according some situations and I am using this:

$this->lang->load('system', 'english');

system is a file in language folder: language/english/system_lang.php

this is not working. wich is wrong ?

thanks.

#2
[eluser]Colin Williams[/eluser]
What about it isn't working? Are you getting a PHP error? Are you unable to access language strings? What exactly is the problem

#3
[eluser]Brahm[/eluser]
as I mentioned in the first post..

I have a language defined in config.php

$config[’language’] = “portugues”;

At runtime I want to switch language to: english

I use this: $this->lang->load(’system’, ‘english’); in the controller and it does not switch my strings to english.

inside of my language files I have something like that:

//english language file
$language['title']="My Title"; //for english

//portuguese language file
$language['title']="Meu Título"; //for portugues.

I always get language strings defined in config.php (portugues strings)

#4
[eluser]Colin Williams[/eluser]
Quote:in the controller and it does not switch my strings to english.

Okay, you didn't say that in your first post. Now we're getting somewhere. How are you accessing strings in the controller (seems like the Views would be a better place, but that's another discussion)? You should be doing:

Code:
$this->lang->line('title');
// or
lang('title');


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.