Skip to content

Feature about Localization #2419

Description

@crustamet

I know we can now put the locale segment in routes but this is not enough.
The problem with this feature how it works right now it has a big issue that we can fix.

  1. After put the segment in all routes and setup the redirects so it can work with negotiateLocale

All website should now contain this {locale} into the URL
the problem with this route is

$routes->add('{locale}', 'Homepage::index');

so if you get into the url of the website
example.com it wont work because the route is expecting the locale so i get 404 ERROR page

I want to redirect the user to the good route and because of 404 cannot do this.

i have to put both routes
$routes->add('{locale}', 'Homepage::index');
$routes->add('/', 'Homepage::index');

but then what is the point with the {locale} variable..

  1. Also when i have only this route and not have both routes like above
    $routes->add('{locale}/', 'Homepage::index');
    I will GET 404 Error Page again. for this to work i have to create another route with another controller to handle the redirect to the {locale} page

  2. After i added a filter that checks the locale and if is not set redirect to it again this only works if you won`t get a 404 error page.

  3. After all this work i realized that i don`t want languages on my website so now i have no option to go back to i have to rework all routes. How can i do this without changing my routes.

I must ask to add in the Configuration of the APP
Enable or Disable Routes LOCALIZATION

because when you switch off localization, all {locale} segments from routes should be empty.
Example :
$routes->add('{locale}/contact', 'Contact::index');

should work with both cases if localization is enabled only these links will work
example.com/{locale}/contact

If localization is disabled both links should work
example.com/{locale}/contact
example.com/contact

I always have problems with this language and there were no way to actually enable or disabled languages on the website.

Is there something i miss ? or i`m doing something wrong ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions