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

Localized URL not found #838

Open
broszies opened this issue Aug 25, 2022 · 4 comments
Open

Localized URL not found #838

broszies opened this issue Aug 25, 2022 · 4 comments

Comments

@broszies
Copy link

Describe the bug
Calling up the page "Test" - added in later - results in an 404, even though the code in web.php, lang/xx/routes.php and the blade are identical.
Caches have been flushed with php artisan optimize:clear and route:clear

Expected behavior
Adding a page (page.blade.php) into the same (or any other) subfolder of /views, adding a translation in /lang/xx/routes.php and adding a route to it in /routes/web.php should result in the page being loaded as long as the existing pages are loaded, too.

More info:

  • Version of Laravel: 8.0.2,
  • Version of the Laravel-localization package 1.7
  • Which middleware is used in Route::groups 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath', 'localize'
  • Copy of the config file ( or at least setting of supportedLocales, useAcceptLanguageHeader and hideDefaultLocaleInURL).
  • Minimal steps to reproduce on a clean Laravel installation.
    laravellocalization.txt

Additional context
Add any other context about the problem here.

Apologies
Noob-ish user here, just in despair about not seeing the obvious.

Attachments

website footer
footer.blade.txt

web.php
web.txt

@broszies
Copy link
Author

Update: Have been experimenting today.

  • Removing the english translations (i.e. updated lang/en/routes.php to entries like "test" => "test", and "politics" => "politics", leads to the german translations being loaded correctly, so that the route gets localized correctly.
  • deleting the english translations completely from lang/en/routes.php results in the german route translations not being loaded anymore

@UtkuDalmaz
Copy link

Having the same

@broszies
Copy link
Author

It gets more frustrating if I read into the documentation. The "old" documentation still works for 90% of cases:
Localizing routes works, but localizing route groups doesnt. Localizing slugs works, localizing models fails.
The new documentation might be awesome for developers, but a noob like me would need clear code snippets on how to use this to localize routes, models and URLs. The newest tutorial is from 2018 and references spatie translatable, not macamara.

I know I am complaining about someone spending their free time to help others. Please do not understand me wrong - I value your work and can understand one needs to restructure a project when taking over. However, in its current state its simply incredible hard for me to use the package.

Best to close this single issue. I will come back in a year or two when documentation gets available :D

@rachids
Copy link

rachids commented Nov 1, 2022

hey @broszies
I ran into a similar problem with the package, the localized routes aren't working in production but they do in local.

since the routes are cached in production, I think it is important to follow the caching guidelines of this package. You can read more about that here.

Not sure if it can fix your issue but it doesn't hurt to try it.

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

3 participants