docute
docute copied to clipboard
suggestion: redirect to the same page if I switch language
Now if I'm visiting the page: /plugins and switch language to zh-Hans, page will be redirected to home page: /zh-Hans/. But I wonder if page can be redirected to /zh-Hans/plugins?
maybe we can allow using a function as nav option:
{
nav: function ($route) {
return []
}
}
seems a bit tricky to find a simple solution
If current language is en, current path is /en/plugins, when user switches to zh-Hans, we can check from the nav config if the path /zh-Hans/plugins exists , if so, redirect to /zh-Hans/plugins, if not, just go Home.
we can't recognize the language from path, it's not always in /en/plugins format
I will add an option for registerComponent to allow adding components in navbar then, let's see how this goes.
provide an option like this?
self.$config = {
languages: ['en', 'zh-CN']
}
if user uses this option, it means all path will follow the same schema. Just an idea.