CodeIgniter Forums
Codeigniter multilingual site - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Codeigniter multilingual site (/showthread.php?tid=61826)



Codeigniter multilingual site - Raza - 05-22-2015

I would like to run CI3 on multiple domains for a multilingual site

Code:
site.en // English
site.gr // Greek translated
site.fr // French translated

What is the best workaround to achieve this? Thanks


RE: Codeigniter multilingual site - davidgv88 - 05-22-2015

You can create a Hook that detects the domain and then make:

$CI =&get_instance();
$CI->lang->load('messages','english') or $CI->lang->load('messages','french').


RE: Codeigniter multilingual site - Raza - 06-19-2015

Thank you

I was able to load the language file with hook
public function load() {
$CI =&get_instance();
if($_SERVER['SERVER_NAME'] == 'site.com')
{
$CI->lang->load('main','english');
}
}

But I have various language files
$CI->lang->load('main','english');
$CI->lang->load('home','english');
$CI->lang->load('about','english');

It's only loading 'main' language file which I have for menu, why it's not loading other files? Also isn't it possible to change the default language to other instead writing all filenames? Thanks


RE: Codeigniter multilingual site - Raza - 06-19-2015

Answering my own question, here is solution in hook

$this->config->set_item('language', 'english');