CodeIgniter Forums

Full Version: Help making a multi lang site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I just finished a multi lang site but I find it difficult so I thought that there should be an easier way to do it

I want a site with this type:

I would like to use only these files:

-one for the config (with lang_default, lang_selected, lang_array, ...)

-one for the MY_url_helper, which will add /XX/ in front of all uris in anchor()

-one for the MY_form_helper, like above will add /XX/ to form_open(), etc.

-one for the pre/post/whatever_controller which simply reads 1st segment, check against array of config, store the lang in $this->config->set_item('lang_selected', the_language_selected) and then remove it from the uri.

I do not want to use custom functions in the logic, only use CI functions in the controllers so if the site is multi lang or not will not change any line on the controllers (only the part in the view which change lang).

I want the lang always in the uri so every time a controller is called, every time reads the lang from the uri and then call $this->config->set_item('lang_selected', the_language_selected); and from that on the app will read the lang from that config var.

Because of this MY_url_helper and MY_form_helper will only add the lang code which is read ALWAYS from $this->config->item('lang_selected') in front of all uris if no valid lang code is given as the 1st segment and it should not check anything else.

Perhaps a cookie for remember the last lang used when the user visited the site, but uris will always have preference.

I want to update the system core without worring about overwritting files.

AND I do not want to bother in the controllers about what lang is selected (the lang files are automatically loaded from the $this->config->item('lang_selected') and then fill the views ok.(I have this done)

I only want to make things like anchor('controller/function'); and the redefined anchor() function should check and add the lang in front if there is no lang in the anchor itself.

Can someone help me doing this???

I think route should be used too.


El Forum

I use Internationalization (i18n) library for CodeIgniter for this.

Hope this helps