docute icon indicating copy to clipboard operation
docute copied to clipboard

suggestion: redirect to the same page if I switch language

Open airyland opened this issue 8 years ago • 4 comments

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?

airyland avatar Jan 05 '17 03:01 airyland

maybe we can allow using a function as nav option:

{
  nav: function ($route) {
    return []
  }
}

seems a bit tricky to find a simple solution

egoist avatar Jan 05 '17 04:01 egoist

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.

airyland avatar Jan 07 '17 14:01 airyland

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.

egoist avatar Jan 07 '17 14:01 egoist

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.

airyland avatar Jan 07 '17 14:01 airyland