CodeIgniter Forums
Language Switcher - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Language Switcher (/thread-74332.html)



Language Switcher - tebogosebake - 09-11-2019

How can i create a language switcher in codeigniter 4 ? ( It was simple In codeigniter 3 using hooks)  Confused


RE: Language Switcher - php_rocs - 09-11-2019

@tebogosebake,

Were you unable to find any suggestions in the documentation? https://codeigniter4.github.io/userguide/outgoing/localization.html?highlight=languages#localization


RE: Language Switcher - kilishan - 09-11-2019

Hooks are still around, just called Events. So you can probably adapt the way you did it previously there.

However, it might be better to use Controller Filters. You could detect the language in the filter and set it in the session, etc before every page load if you do that globally.