^0.7.1
I think this feature is necessary. It makes finding files easier ,the management of files clearer, and developers can simply customize a welcome page through docs/README.md or just redirect to the index of language en as default page if needed.
module.exports = {
locales: {
'/en/': {
lang: 'en-US'
},
'/ja/': {
lang: 'ja-JP'
},
'/zh/': {
lang: 'zh-CN'
}
},
}
docs/
- .vuepress/
- en/
- foo/
- qux/
- api.md
- README.md
- ja/
- foo/
- qux/
- api.md
- README.md
- zh/
- foo/
- qux/
- api.md
- README.md
- README.md
docs/
- .vuepress/
- foo/
- ja/
- foo/
- qux/
- api.md
- README.md
- qux/
- zh/
- foo/
- qux/
- api.md
- README.md
- api.md
- README.md
I start to realise the issue that you are experiencing. I have looked into it and looks like it will require some major refactoring. @ulivz do you think we should facilitate this?
Or, if https://github.com/vuejs/vuepress/issues/290#issuecomment-387287748 is not a bug, is there any ways to disable the language selector in specified pages?
We don't plan to change the implementation for i18n, but this feature can be done via priority route after plugin API was released.
For now, you can test this by these steps
lib/app/.temp/routes.js:{
path: "/",
redirect: "/en/"
},
Create a empty README.md at root directory (Used to generate root index.html which makes static server work.)
Test your i18n structure.
It's OK.
Perhaps this feature request could be restated as:
"Allow user to have a flat file structure for multiple languages by giving them the option to pass in redirect path"
module.exports = {
redirectPath: "/en/"
}
Docs would need to be updated with description of config switch: used to redirect traffic coming from the root path to another directory.
Useful if you would rather have a flat folder structure for all of your languages, i.e.
docs/
- .vuepress/
- en/
- foo/
- api.md
- README.md
- zh/
- foo/
- api.md
- README.md
instead of
docs/
- .vuepress/
- foo/
- api.md
- README.md
- zh/
- foo/
- api.md
- README.md
The blank README.md at the root directory should be autogenerated if it isn't present - this way users need only add the config option.
Not sure what to do in case one is present? Could offer a warning that the readme there is for redirection
purposes only and thus content will not be accessible due to redirects?
If you like this idea, re-open this issue and I'll make a PR :smile_cat:
@Dafrok what do you think of the above suggestion? :octocat:
@GrayedFox LGTM
Ahoy, I am still planning on implementing this - first attempt (at getting it to be done during the build process) was unsuccessful - so I next attempt will be to take a more bootleg approach and try to update the .temp/routes/.js in a post-install script sort of way
Since the existing i18n model has taken root, now, and for the foreseeable future, we are not going to modify the default i18n mode.
Of course, if you are passionate about your own model, consider using the plugin API to custom this during build time.
Most helpful comment
Perhaps this feature request could be restated as:
"Allow user to have a flat file structure for multiple languages by giving them the option to pass in redirect path"
Config
Expected
Docs would need to be updated with description of config switch: used to redirect traffic coming from the root path to another directory.
Useful if you would rather have a flat folder structure for all of your languages, i.e.
instead of
The blank README.md at the root directory should be autogenerated if it isn't present - this way users need only add the config option.
Not sure what to do in case one is present? Could offer a warning that the readme there is for redirection
purposes only and thus content will not be accessible due to redirects?
If you like this idea, re-open this issue and I'll make a PR :smile_cat: