Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature about Localization #2419

Closed
crustamet opened this issue Nov 20, 2019 · 3 comments
Closed

Feature about Localization #2419

crustamet opened this issue Nov 20, 2019 · 3 comments

Comments

@crustamet
Copy link
Contributor

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 ?

@crustamet
Copy link
Contributor Author

someone please help me with this i am open to anything...

@lonnieezell
Copy link
Member

While it's an interesting feature that probably warrants looking into, we are generally not accepting new features until after the final release.

Additionally, this area is for bug reports. Support requests should be asked on our forums where many more people can help out.

Short answer - no, there's no way to globally turn on/off locales in routes.

@crustamet
Copy link
Contributor Author

Thanks man :D hope you good.
I will make the on / off switch myself.
and try to figure out how locale works and try this myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants