Ads Inside Post

Search in This Blog

How to use multilanguage in CodeIgniter

Problem:

Suppose you want to use Italian language in CodeIgniter then how to do it?



Solution:

CodeIgniter provide a facility that you can store the predefined words in array in separate files. after that you can use it as per your requirements.

Example:

1- create a folder name "italian" under "application\language".
2- under this folder create a "italian_lang.php" file as below matter. change it's matter as per your requirements.
<?php
$lang['home_slide_1']        = "Rendi <span>unici</span> i tuoi parastinchi";
$lang['home_latuaidea_title']        = "La tua <br/>idea";
/// and many more....
?>
now your file is created, now the question is that how to use it?
4- in view where you want to write italian text at the top of file load this file as below method:
$this->lang->load('italian', 'italian');


<?php echo $this->lang->line('home_slide_1');?>
<?php echo $this->lang->line('home_latuaidea_title');?>