i18n icon indicating copy to clipboard operation
i18n copied to clipboard

feat: add possibility to disable default redirect for prefix_and_default strategy

Open Renhor opened this issue 3 years ago • 4 comments

Regarding to issue #1401

Added property to config:

i18n: {
  disableDefaultRedirect: boolean | string[] // false by default
}

It works only for strategy prefix_and_default. It disables redirect for routes are prefixed with default language, or we can choose custom path pattern for disabling redirect behaviour:

i18n: {
  disableDefaultRedirect: [
    '/about',
    '/blog/*'
  ]
}

UPD:

Added property to config:

type PrefixAndDefaultRule = 'default' | 'prefix'

i18n: {
  prefixAndDefaultRule?: PrefixAndDefaultRule
}

By setting the value prefixAndDefaultRule = 'prefix' we are no longer redirected from prefixed routes and if there is no prefix then the other routers will also have no prefix.

For now, I decided not to implement an array with a list of routes for which the default behavior is disabled

Renhor avatar May 04 '22 15:05 Renhor

rchl Thanks for the quick review. Unfortunately, I will only be able to continue working on the task today. I decided to abandon the route array and changed the implementation following your advice. Updated the information in the first post

Renhor avatar May 11 '22 20:05 Renhor

Corrected the code that was causing the tests to crash

Renhor avatar May 12 '22 11:05 Renhor

I need this feature ! please, thanks... @Renhor any update bro?

juliomontilla100 avatar Oct 03 '22 17:10 juliomontilla100

This feature would be highly appreciated. Get in touch with me, if there is anything I can do.

DanielHefti avatar Nov 15 '22 08:11 DanielHefti