i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Selectively disable redirects to prefixless for default locale routes with prefix_and_default strategy

Open eatyrghost opened this issue 3 years ago • 6 comments

Problem We are using the prefix_and_default strategy with a default locale set to en-us.

If we visit a route with the default locale as the prefix, e.g. /en-us/about-us, we are redirected to the prefixless route, /about-us. This is acceptable for most of our pages.

In a handful of cases, we don't want to redirect - we want to specifically use the /en-us prefix.

Desired Solution There might be two ways we could configure this.

  1. A new property on the page component:
export default {
    disableDefaultRedirect: true
};
  1. A configuration that accepts a boolean or an array of prefixless paths:
// Applies to all routes
i18n: {
    disableDefaultRedirect: true
}

// Applies to /about-us and /products only
i18n: {
    disableDefaultRedirect: [
        '/about-us',
        '/products'
    ]
}

eatyrghost avatar Feb 17 '22 16:02 eatyrghost

That seems very useful

jeiksegovia avatar Feb 17 '22 16:02 jeiksegovia

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 19 '22 12:04 stale[bot]

This feature is still relevant....

jeiksegovia avatar Apr 28 '22 03:04 jeiksegovia

nice!!

jeiksegovia avatar Jul 22 '22 18:07 jeiksegovia

I'm looking for this feature as well!

DanielHefti avatar Nov 15 '22 08:11 DanielHefti

we need this! thanks

julioglobal100 avatar Nov 19 '22 04:11 julioglobal100