Welcome Guest, Not a member yet? Register   Sign In
Localization in Routes
#1
Brick 
(This post was last modified: 10-24-2018, 06:54 AM by Dmonkeyjazz.)

While trying out CI4 one of the first new features i wanted to check out was the localization and the handling of it through the routing.

We often develop multilingual websites and this is an important feature for us that we need to enable/disable based on the configuration.
In CI3 we accomplished this using our own version of MY_Lang, so we're very excited to see it natively supported in ci4.

However we notice strange behaviour when configuring 2 locales and 1 default locale.
When accessing the root of the site (without specifying a locale in the url) CI4 gives us its 404 page.
While I was expecting that a request to www.mywebsite.com would result in a redirect to www.mywebsite.com/defaultLocale

Am I missing something ?
Is this indeed the intended behaviour ?

My setup is this:

App.php:
PHP Code:
public $defaultLocale 'locale_1';
public 
$negotiateLocale true;
public 
$supportedLocales = ['locale_1''locale_2']; 

Routes.php:
PHP Code:
$routes->add('{locale}/''Home::index'); 
Reply


Messages In This Thread
Localization in Routes - by Dmonkeyjazz - 10-24-2018, 05:24 AM
RE: Localization in Routes - by Przem4S - 11-06-2018, 02:01 AM
RE: Localization in Routes - by Pertti - 11-06-2018, 02:35 AM
RE: Localization in Routes - by Dmonkeyjazz - 11-09-2018, 04:50 AM
RE: Localization in Routes - by puschie - 11-09-2018, 07:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB