Closed TiEul closed 4 years ago
@meteorlxy Let me know if I need to fix anything here or if you have any objections to this PR in general. Just as a note, I actually think the behavior I added should be the default behavior, I merely added the option to turn it off to not cause any backwards-breaking behaviors. Generally, I would assume that choosing the closest fallback language is better than "randomly" choosing English, for example.
Summary
This change introduces the fuzzyLocales option to the redirect plugin. It allows users to configure the language-based redirects in a way that they only take the language into account while ignoring specific dialects. For example, this means that users with browsers that send
de-AT
as a locale will still be forwarded to thede-DE
locale, as the plugin will only take the lowercasede
into account while ignoring the region-specific uppercaseDE
andAT
. This is only a fallback, so if both exist, users will be forwarded to the appropriate dialect version of their language.Which package does this PR involve? (check one)
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)Other information:
https://github.com/vuepress/vuepress-community/issues/34