CodeIgniter Forums
Localization - In routes method - 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: Localization - In routes method (/showthread.php?tid=78271)



Localization - In routes method - manager - 12-26-2020

Hi everyone. 
I'm trying to make multilanguage site with two languages (en, ru).
In app/config default lang set as 'en'.
I have a route with a locale placeholder like this:
Code:
$routes->get('/{locale}', 'Home::index');

When i open domain.com/ in the browser it shows me content in english.
When i open domain.com/en  - it gives me same content as above.
when i open domain.com/en/home - it gives me same content as above

The first question is how to avoid this kind of situation?
And i thought if i added 'locale' placeholder , then domain.com/ should give me 404 error, but not? Why?
And what is the best way to make multilanguage app in CI4?

Thanks in advance.


RE: Localization - In routes method - InsiteFX - 12-26-2020

How to set specific language for all pages in Codeigniter 4