Welcome Guest, Not a member yet? Register   Sign In
{locale} placeholder in routes

(This post was last modified: 06-09-2022, 01:57 AM by webdeveloper.)

Thank you for comment! Always happy to see any other solutions.

Yep, it can be done like this too. I have never think about to create filter for this. Router should handle this "right".

One important difference is that your locale have to be placed always on the first place of URL. 

This wont work for you:

PHP Code:
$routes->group('translations', function ($routes) {
  $routes->group('{locale}', function ($routes) {

Second one difference is that router is called before filter. A lot of (possibly unimportant) code can be done until page not found exception is thrown.

Why did you remove second part of locale? This is used in most cases for variants of language e.g. "en-US". I consider this language fallback behaviour as useful

Quote:So, if you are using the locale fr-CA, then a localized message will first be sought in Language/fr/CA, then in Language/fr, and finally in Language/en.

Messages In This Thread
{locale} placeholder in routes - by webdeveloper - 06-08-2022, 06:23 AM
RE: {locale} placeholder in routes - by webdeveloper - 06-09-2022, 01:56 AM
RE: {locale} placeholder in routes - by InsiteFX - 06-09-2022, 11:57 PM
RE: {locale} placeholder in routes - by kenjis - 06-10-2022, 06:05 PM

Theme © iAndrew 2016 - Forum software by © MyBB