You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.4 KiB

  1. # Translating the QMK Docs
  2. All files in the root folder (`docs/`) should be in English - all other languages should be in subfolders with the ISO 639-1 language codes, followed by `-` and the country code where relevant. [A list of common ones can be found here](https://www.andiamo.co.uk/resources/iso-language-codes/). If this folder doesn't exist, you may create it. Each of the translated files should have the same name as the English version, so things can fall back successfully.
  3. A `_summary.md` file should exist in this folder with a list of links to each file, with a translated name, and link preceded by the language folder:
  4. ```markdown
  5. * [QMK简介](zh-cn/getting_started_introduction.md)
  6. ```
  7. All links to other docs pages must also be prefixed with the language folder. If the link is to a specific part of the page (ie. a certain heading), you must use the English ID for the heading, like so:
  8. ```markdown
  9. [建立你的环境](zh-cn/newbs-getting-started.md#set-up-your-environment)
  10. ## 建立你的环境 :id=set-up-your-environment
  11. ```
  12. Once you've finished translating a new language, you'll also need to modify the following files:
  13. * [`docs/_langs.md`](https://github.com/qmk/qmk_firmware/blob/master/docs/_langs.md)
  14. Each line should contain a country flag as a [GitHub emoji shortcode](https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md#country-flag) followed by the name represented in its own language:
  15. ```markdown
  16. - [:cn: 中文](/zh-cn/)
  17. ```
  18. * [`docs/index.html`](https://github.com/qmk/qmk_firmware/blob/master/docs/index.html)
  19. Both `placeholder` and `noData` objects should have a dictionary entry for the language folder in a string:
  20. ```js
  21. '/zh-cn/': '没有结果!',
  22. ```
  23. The `nameLink` object, for setting the "QMK Firmware" heading link in the sidebar, must also be added to:
  24. ```js
  25. '/zh-cn/': '/#/zh-cn/',
  26. ```
  27. And make sure to add the language folder in the `fallbackLanguages` list, so it will properly fall back to English instead of 404ing:
  28. ```js
  29. fallbackLanguages: [
  30. // ...
  31. 'zh-cn',
  32. // ...
  33. ],
  34. ```
  35. ## Previewing the Translations
  36. See [Previewing the Documentation](contributing.md#previewing-the-documentation) for how to set up a local instance of the docs - you should be able to select your new language from the "Translations" menu at the top-right.
  37. Once you're happy with your work, feel free to open a pull request!