Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion] Multiple Language Support #41

Closed
ulivz opened this issue Apr 15, 2018 · 1 comment
Closed

[Discussion] Multiple Language Support #41

ulivz opened this issue Apr 15, 2018 · 1 comment
Labels
type: question or discussion Question or discussion

Comments

@ulivz
Copy link
Member

ulivz commented Apr 15, 2018

After exploration with current working flow and code details, and tried to implement i18n with different approach. finally I think that the idea from @egoist's docute would be minimalistic and useful enough for now.

Let me describe the story.

Since most users (Vue is also the same) will only consider supporting the main language support at the beginning, so I pass in an array that contains link items to nav:

module.exports = {
  themeConfig: {
    nav: [
      {
        text: 'Guide',
        link: '/guide/',
      },
      // rest pages ...
    ],
  }
}

Then one day, I find I want to add translations for my docs, taking adding Chinese translation as an example, I will need to do the following work to achieve i18n:

  1. Create a directory in the name of language at .vuepress
  2. Change the config to:
const langs = [
  { text: 'English', link: '/' },
  { text: '简体中文', link: '/zh/' },
]

module.exports = {
  themeConfig: {
    nav: {
      default: [
        { text: 'Guide', link: '/guide/' },
        { title: 'Languages', type: 'dropdown', items: langs },
      ],
      zh: [
        { text: '指南', link: '/zh/guide/' },
        { title: '选择语言', type: 'dropdown', items: langs },
      ]
    }
  }
}

There is a WIP PR for this solution: https://github.com/ulivz/vuepress/pull/1 (i18n + Chinese Translations)

This solution also has some issues:

  1. No consideration for i18n for Vue Component. (Using vue-i18n or making an another tiny lib?)
  2. No consideration for the two field title and description at config. (Don't have a good idea now.)

Here I just said my thoughts, free free to share your thoughts, so that we can deliver multiple language support faster and better.

Thanks.

@yyx990803 @egoist

Updated

Finished Chinese translation and open a complete PR: #48

@yyx990803
Copy link
Member

Closing in favor of the PR. Let's continue discussion there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Question or discussion
Projects
None yet
Development

No branches or pull requests

2 participants