CodeIgniter Forums
Need help with language helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: Need help with language helper (/thread-73234.html)



Need help with language helper - florent6001 - 04-03-2019

Can you help me ?
I cannot switch my language into my view.

Here is my config.php

$autoload['helper'] = array('url', 'file', 'language');
$autoload['language'] = array('homepage');

My view is on php like that : <?= lang('carousel_title'); ?>

My controller : public function index($language = 'french')

And here is my routes :

// Routes française
$route['fr'] = 'Page/index';

// Route Anglaise
$route['en'] = 'Page/index/english';


My problem, is for every url, i'm in french. /en didn't work. How set the default language for an user in my controller ?


RE: Need help with language helper - jreklund - 04-03-2019

Personally I'm using a language loader so that I don't need to specify it in every url.
https://forum.codeigniter.com/thread-71665-post-357488.html#pid357488


RE: Need help with language helper - florent6001 - 04-03-2019

So i need to change all my system ?


RE: Need help with language helper - jreklund - 04-04-2019

You don't have too, but in case you need us to help you debug your system you need to supply a lot of more code. The best option is to make a small demo with just your language code and upload it somewhere.

E.g.
What's in your language helper?
You controller specifies french and not fr, so will /english work? (In case your route are broken)
What does it do with $langauge after you have supplied it?
Do you have multiple controllers or just one?
etc


RE: Need help with language helper - neuron - 04-06-2019

http://avenir.ro/free-content-ads/
 here is nice tutorial about how to build Multilanguage app in Codeignter