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

Extract should redirect logic to method on base middleware #792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

standaniels
Copy link

In some cases the hideDefaultLocaleInURL isn't a static value and reading the config wouldn't suffice. For example:

  • Domain example.nl
    • Has locales:
      • nl
    • Default locale: nl
    • Hide default locale: true
  • Domain example.be
    • Has locales:
      • fr
      • nl
    • Default locale: fr
    • Hide default locale: false

This PR extracts the logic to determine whether the request should be redirected to the (non-) localized URL or not to a method on the base middleware class, so a user could write their own middleware, but are able to extend the package middleware; they only need to overwrite the shouldRedirectToLocalizedUrl and shouldRedirectToNonLocalizedUrl methods.

What do you think?

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

Successfully merging this pull request may close these issues.

2 participants