Welcome Guest, Not a member yet? Register   Sign In
config language and the i18n-wiki tutorial
#1

[eluser]tobben[/eluser]
Concerning the Wiki-post:
i18n-wiki post

Anyone figured out a way to swap language settings in the config file, depending on the language set in the i18n script?

So, if I swap language to "no" (norwegian), the language set is also switched - so I could get me some nice norwegian day names on ex. the calendar.


Sincerly yours,

tobben Tongue
#2

[eluser]tobben[/eluser]
Update:

I added this to the controller construct:



Code:
if($this->uri->segment(1) == 'no')
            {    
                $this->config->set_item('language', 'norwegian');
            }
            else
            {    
                $this->config->set_item('language', 'english');
            }



So if the URI is:

http://localhost:8888/en/kalender/dato/2007/12 - show english language files
http://localhost:8888/no/kalender/dato/2007/12 - show norwegian language files





It works, but its probably a lame way to change this system language.


Suggestions to make it work globaly on all scripts?
#3

[eluser]Michael Wales[/eluser]
Documentation: Hooks
#4

[eluser]Rick Jolly[/eluser]
As an alternative to hooks, you could put it in the constructor of a custom parent controller and extend it. You might find the parent controller handy for other things as well.
#5

[eluser]wemago[/eluser]
you should see how language is set at the mini application
by Peccavio. They did a really good job.




Theme © iAndrew 2016 - Forum software by © MyBB