Welcome Guest, Not a member yet? Register   Sign In
How to work with auto routing and languages in CI4?
#1

Hi, I've enabled auto routing ( https://codeigniter.com/user_guide/incom...g-improved ) in my CI4 project, and before start work with Localization ( https://codeigniter.com/user_guide/outgo...th-locales ) I was calling my controller method like this: http://mydomain.com/mycontroller/someaction , but now with Localization on, I'm using two languages: en, pt-BR. To call the same URL in the right way would be http://mydomain.com/pt-BR/mycontroller/someaction, but working with auto routing and Localization, this URI with "locale" (pt-BR or en) does not work. Did I forget something? What is the right way to work with Location + auto routing improved in CI4? Thanks.
Reply
#2

The auto routing does not support localization. It does nothing for localization.

I recommend you use the defined route with locale:
https://codeigniter.com/user_guide/outgo...#in-routes
Reply
#3

For localization see this tutorial.

Creating a multilingual website with CodeIgniter 4 (part 1)

Creating a multilingual website with CodeIgniter 4 (part 2)
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Thank you! Gradually I am understanding the difference between CI3 and CI4.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB