Here are the guidelines for translating docs in Vue ecosystem, including official libraries like Pinia, Vue Router, etc.
- Language: Every project might have English docs by default. And it's welcome to add docs in other languages. Usually, they are the translations of the English docs.
- Language List UI: It's a menu list for all the available languages on the doc site. It's helpful for users to switch the docs to their prefered language.
- Checkpoint: Since the English docs are keep updating. It's very important for other language docs to have some "checkpoints". A checkpoint is the hash and date of the latest commit when you update the translation. It's crucial for long-term maintenance since all the further translation sync-ups are based on their previous checkpoints.
- Translation Status: It's the checkpoints information for all the languages that we have translated.
- Translation Status UI: It's a block of UI displaying the Translation Status. Usually, it's the date of the latest update for the current language. It's helpful for users to know how fresh the current translation is. Also, it's an invisible encouragement for users to contribute the translations when they find anything outdated.
If you want to start translating the docs in a new language:
- Set up the new language in the repo
- Translate all the content into the new language
- Initialize the checkpoint information into the Translation Status
- Commit all the changes
If you want to keep a translation up-to-date:
- Compare the English docs between the latest one and the one on the current language checkpoint.
- Create a git branch and update the translation according to the compare result.
- Update the current langauge checkpoint.
- Commit all the changes
The typical workflow is like this:
Here is some practical advice for the translation. However, when you contribute, please do follow the guidelines of the project for more details.
Usually, the docs of a project is a sub-package based on VitePress in their repo/workspace. So this part is all based on VitePress.
To translate the docs, you have 2 options to follow:
- You can add a locale information in the VitePress config.
- You can translate all the menu items and navigation items in the new locale of the VitePress config.
- You can translate all the i18n info in the new locale of the VitePress config.
- The content can be translated and put into a
<lang>
sub-folder.
In this way above, you will get the translation in the same doc site with:
- A new link to your translation in the Language List UI
- A sub-path for your translation. (e.g. in Vue Router docs https://router.vuejs.org/, the URL of the Chinese translation is https://router.vuejs.org/zh/)
For better doing that, we have prepared a project named vitepress-translation-helper
to help you. See more usage details on its README.
- You can translate all the menu items and navigation items directly in the VitePress config.
- You can translate all the i18n info directly in the VitePress config.
- You can translate all the content directly.
- You need to self-host your doc site with necessarily config change like the domain, the deployment config, etc.
- You are highly encouraged to create a pull request to the official doc site to add a new link to your translation doc site in the Language List UI.
In this way above, you will get the translation in your own host.
See more information on the VitePress Internationalization page.
Also, in VitePress v1.0.0-rc35 and above, it supports dir
field in frontmatter for each page.
- Vue Router (GitHub repo) (translation guidelines)
- Pinia (GitHub repo) (translation guidelines)
- Vue Test Utils (GitHub repo)
- Vue 3 Migration Guide (GitHub repo)
If you have a project would like to show and call for translations, feel free to add it here and create a pull request.