Develop Multilingual site using codeigniter i18n Library

CodeIgniter has lot of Useful helper functions and libraries , Classes. Here we are going to Develop a Multilingual Site Using CodeIniger Language Class and i18n Library.

I am assuming that you know basic installation of CI application, if no please have look on CodeIgniter Tutorials

How it works:

codeIgniter Localization steps :

We are going to put our language files in Language folder which located at (application/language/).

In our application we have three languages English, French, german

In each folder we have file having name contact_lang.php contains respective languages text.

It has simple syntax:

Our english/contact_lang.php has code as follows;

We need to make same files as per required languages. Just we have to write right side part in required language.


Download: here
Put MY_Language.php and MY_Config.php in application/core
Put MY_language_helper.php in application/helpers/

Configuration :

You must be using pretty URLs (without index.php). With Apache it’s usually achieved with mod_rewrite through an .htacess

In config.php

$config[‘base_url’] must correspond to your configuration.

$config[‘index_page’] = “”

In routes Add Fallowing :

Now Create your Controller :

Final Step Create your view :

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets. Protection Status