Change language in config.php dynamic [RESOLVED] |
[eluser]ELRafael[/eluser]
How do i do this?? In the constructor of the controller Code: $this->config->set_item('language', 'pt-br'); But didn't work... any ideas? (Read better the user_guide)
[eluser]Derek Allard[/eluser]
what is your language folder called and where is it saved?
[eluser]Unknown[/eluser]
Hello I have the same problem. I created 3 folders (de, en and fr) in system/language/ When I autoload 1 of the three folders there is no problem. But when i want to change then the language he don't react on my changes. I try to change the language (in the views) with this code: Code: $this->lang->load('site', $headinfo['accountinfo']['language']); My config folder: Code: $config['language'] = "de"; It would be great if someone could help me! Thanks!
[eluser]xwero[/eluser]
@Rafael : have you got an /language/pt-br directory? if it's easier for you just name it brasilian ![]() @flicker : you have to change the language configuration setting Code: $this->config->set_item('language', $headinfo['accountinfo']['language']);
[eluser]ELRafael[/eluser]
i have the folder called pt-br i tried in system/language/pt-br and system/application/language/pt-br, but both didn't work. whats the diferrence of brazilian and pt-br? i know that brazil is the only country that speaks "another" kind of portuguese, but don't matter if is pt-br, brazilian, brazuca, mixugues, or otherelse the name of folder-se! if i changed "manual" the value from config.php, it works soo fine that i almost cry. but dynamic neither Daileon can resolved!!!!
[eluser]xwero[/eluser]
and where or how do you want to use the string? I don't know when you make custom files you can depend on the autoloading to load the file, probably you would have to do something like Code: $this->lang->load('custom_file_lang'); It doesn't matter if you call it pt-br or brazilian, it's where you feel most comfortable with.
[eluser]ELRafael[/eluser]
allright, but the problem is: i have the string inside the config.php (the main config file). i didn't create a custom config file, or my own file. just changed the original, the main, the genesis one! system/application/config/config.php. So i think that i don't need to load this, right? In fact, what i wish is: The user clicks in link that changes the language of site. And all the language strings are inside another file. As flicker (the dolphin?) told, the system doesn't react when i wanna change the $config['language'] in runtime.
[eluser]xwero[/eluser]
I meant by custom files, custom language files. When the configured language is changed for instance the validation errors show the correct language strings. I haven't used custom language files myself because it seems that with language change comes page changes too so i set up separate view directories.
[eluser]ELRafael[/eluser]
i didn't put in different views folders.... just did that: application/views/hello_view.php Code: <h1><?=$this->lang->line('hello_title');?></h1> application/language/pt-br/app_lang.php Code: $lang['hello_title'] = 'Olá Mundo'; application/language/en/app_lang.php Code: $lang['hello_title'] = 'Hello World'; and this is working... but change dynamic don't > ![]()
[eluser]xwero[/eluser]
That is strange. I looked at the validation class and they use Code: $this->CI->lang->load('validation'); Code: $this->lang->load('app'); |
Welcome Guest, Not a member yet? Register Sign In |