Welcome Guest, Not a member yet? Register   Sign In
URL translation, is it possible?
#1

Hello,

I've been trying to translate one of my URL's in example '/nl/wachtwoord-vergeten/' in English it should be '/en/forgot-password/'. The translation switch is working correctly, i'm able to change the App\defaultLocale.

In my baseController i've setup the following:
PHP Code:
$language = \Config\Services::language();
$language->setLocale$lang }; 

This is working correctly, i've checked this by calling getLocale() in my view to be shure it's loaded. Next up is routing the URL, i've been reading about route_to();  and absolutly love it! Makes it so much easier to manage.

My routes looks like this:
PHP Code:
$routes->add("{locale}/" lang('Auth.forgotPasswordUri'), 'Accounts::resetPassword', ['as' => 'forgot_password']); 

Now i must admit, don't know if you can use the lang() helper in the routes, but we can always change this if needed.

Did anyone had the same issue and resolved this, would love to get this working Smile 

Kind Regards
Reply




Theme © iAndrew 2016 - Forum software by © MyBB