Ver código fonte

Expose zh-cn docs, delete bad zh docs, add docs for adding translations (#6855)

* expose zh-cn docs, delete bad zh docs, add docs for adding translations

* Update docs/translating.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/translating.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* update for python 3
Jack Humbert 5 anos atrás
pai
commit
68072e931a
8 arquivos alterados com 159 adições e 230 exclusões
  1. 0 4
      docs/LANGS.md
  2. 3 0
      docs/_langs.md
  3. 1 0
      docs/_summary.md
  4. 36 4
      docs/index.html
  5. 29 0
      docs/translating.md
  6. 90 91
      docs/zh-cn/_summary.md
  7. 0 32
      docs/zh/README.md
  8. 0 99
      docs/zh/_summary.md

+ 0 - 4
docs/LANGS.md

@@ -1,4 +0,0 @@
-# Languages
-
-* [English](/)
-* [Chinese](zh/)

+ 3 - 0
docs/_langs.md

@@ -0,0 +1,3 @@
+- Translations
+  - [:uk: English](/)
+  - [:cn: 中文](/zh-cn/)

+ 1 - 0
docs/_summary.md

@@ -109,6 +109,7 @@
   * [Using Eclipse with QMK](other_eclipse.md)
   * [Using VSCode with QMK](other_vscode.md)
   * [Support](support.md)
+  * [How to add translations](translating.md)
 
 * QMK Internals (In Progress)
   * [Defines](internals_defines.md)

+ 36 - 4
docs/index.html

@@ -3,6 +3,7 @@
 <head>
   <meta charset="UTF-8">
   <title>QMK Firmware</title>
+  <link rel="icon" type="image/png" href="gitbook/images/favicon.png">
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
   <meta name="description" content="Description">
   <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">  
@@ -20,19 +21,50 @@
   <div id="app"></div>
   <script>
     window.$docsify = {
+      alias : {
+        '/en/(.*)': '/$1',
+        '/en-us/(.*)': '/$1',
+        '/en-gb/(.*)': '/$1',
+        '/.*/_langs.md': '/_langs.md',
+      },
+      basePath: '/',
       name: 'QMK Firmware',
-      nameLink: 'https://qmk.fm/',
+      nameLink: '/',
       repo: 'qmk/qmk_firmware',
       loadSidebar: '_summary.md',
+      loadNavbar: '_langs.md',
+      mergeNavbar: true,
       auto2top: true,
       formatUpdated: '{YYYY}/{MM}/{DD} {HH}:{mm}',
       search: {
         paths: 'auto',
-        placeholder: 'Search Documentation...',
-        noData: 'We could not find any documents matching your search.',
+        placeholder: {
+          '/zh-cn/': '搜索',
+          '/': 'Search'
+        },
+        noData: {
+          '/zh-cn/': '没有结果!',
+          '/': 'No results!'
+        },
         depth: 6
       },
-      fallbackLanguages: ['zh']
+      plugins: [
+        function (hook, vm) {
+          hook.beforeEach(function (html) {
+            if (/githubusercontent\.com/.test(vm.route.file)) {
+              url = vm.route.file
+                .replace('raw.githubusercontent.com', 'github.com')
+                .replace(/\/master/, '/blob/master')
+            } else {
+              url = 'https://github.com/qmk/qmk_firmware/blob/master/docs/' + vm.route.file
+            }
+            var editHtml = '[:memo: Edit Document](' + url + ')\n'
+            return html
+              + '\n\n----\n\n'
+              + editHtml
+          })
+        },
+      ]
     }
   </script>
   <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

+ 29 - 0
docs/translating.md

@@ -0,0 +1,29 @@
+# How to translate the QMK docs into different languages
+
+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.
+
+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:
+
+    * [QMK简介](zh-cn/getting_started_introduction.md)
+
+Once you've finished translating a new language, you'll also need to modify the following files:
+
+* [`docs/_langs.md`](https://github.com/qmk/qmk_firmware/blob/master/docs/_langs.md)  
+  Each line should contain a country flag in the format `:us:` followed by the name represented in its own language:  
+  
+      - [:cn: 中文](/zh-cn/)
+
+* [`docs/index.html`](https://github.com/qmk/qmk_firmware/blob/master/docs/index.html)  
+  Both `placeholder` and `noData` objects should have a dictionary entry for the language folder in a string:  
+  
+      '/zh-cn/': '没有结果!',
+
+## Previewing the translations
+
+Before opening a pull request, you can preview your additions if you have Python 3 installed by running this command in the `docs/` folder:
+
+    python -m http.server 9000
+
+and navigating to http://localhost:9000/ - you should be able to select your new language from the "Translations" menu at the top-right.
+
+Once you're happy with your work, feel free to open a pull request!

+ 90 - 91
docs/zh-cn/_summary.md

@@ -1,107 +1,106 @@
-* [完全菜鸟指南](newbs.md)
-  * [入门](newbs_getting_started.md)
-  * [构建你的第一个固件](newbs_building_firmware.md)
-  * [刷新固件](newbs_flashing.md)
-  * [测试和调试](newbs_testing_debugging.md)
-  * [Git最佳实践](newbs_best_practices.md)
-  * [学习资源](newbs_learn_more_resources.md)
+* [完全菜鸟指南](zh-cn/newbs.md)
+  * [入门](zh-cn/newbs_getting_started.md)
+  * [构建你的第一个固件](zh-cn/newbs_building_firmware.md)
+  * [刷新固件](zh-cn/newbs_flashing.md)
+  * [测试和调试](zh-cn/newbs_testing_debugging.md)
+  * [Git最佳实践](zh-cn/newbs_best_practices.md)
+  * [学习资源](zh-cn/newbs_learn_more_resources.md)
 
-* [QMK基础](README.md)
-  * [QMK简介](getting_started_introduction.md)
-  * [向QMK贡献](contributing.md)
-  * [如何使用Github](getting_started_github.md)
-  * [获得帮助](getting_started_getting_help.md)
+* [QMK基础](zh-cn/README.md)
+  * [QMK简介](zh-cn/getting_started_introduction.md)
+  * [向QMK贡献](zh-cn/contributing.md)
+  * [如何使用Github](zh-cn/getting_started_github.md)
+  * [获得帮助](zh-cn/getting_started_getting_help.md)
 
-* [问题解答](faq.md)
-  * [一般问题](faq_general.md)
-  * [构建/编译](faq_build.md)
-  * [调试/故障排除](faq_debug.md)
-  * [键盘映射](faq_keymap.md)
+* [问题解答](zh-cn/faq.md)
+  * [一般问题](zh-cn/faq_general.md)
+  * [构建/编译](zh-cn/faq_build.md)
+  * [调试/故障排除](zh-cn/faq_debug.md)
+  * [键盘映射](zh-cn/faq_keymap.md)
 
 * 详细指南
-  * [安装构建工具](getting_started_build_tools.md)
-  * [vagrant指南](getting_started_vagrant.md)
-  * [构建/编译指令](getting_started_make_guide.md)
-  * [刷新固件](flashing.md)
-  * [定制功能](custom_quantum_functions.md)
-  * [映射概述](keymap.md)
+  * [安装构建工具](zh-cn/getting_started_build_tools.md)
+  * [vagrant指南](zh-cn/getting_started_vagrant.md)
+  * [构建/编译指令](zh-cn/getting_started_make_guide.md)
+  * [刷新固件](zh-cn/flashing.md)
+  * [定制功能](zh-cn/custom_quantum_functions.md)
+  * [映射概述](zh-cn/keymap.md)
 
-* [硬件](hardware.md)
-  * [AVR处理器](hardware_avr.md)
-  * [驱动](hardware_drivers.md)
+* [硬件](zh-cn/hardware.md)
+  * [AVR处理器](zh-cn/hardware_avr.md)
+  * [驱动](zh-cn/hardware_drivers.md)
 
 * 参考
-  * [键盘指南](hardware_keyboard_guidelines.md)
-  * [配置选项](config_options.md)
-  * [键码](keycodes.md)
-  * [记录最佳实践](documentation_best_practices.md)
-  * [文档模板](documentation_templates.md)
-  * [术语表](reference_glossary.md)
-  * [单元测试](unit_testing.md)
-  * [有用的功能](ref_functions.md)
-  * [配置器支持](reference_configurator_support.md)
-  * [info.json 格式](reference_info_json.md)
+  * [键盘指南](zh-cn/hardware_keyboard_guidelines.md)
+  * [配置选项](zh-cn/config_options.md)
+  * [键码](zh-cn/keycodes.md)
+  * [记录最佳实践](zh-cn/documentation_best_practices.md)
+  * [文档模板](zh-cn/documentation_templates.md)
+  * [术语表](zh-cn/reference_glossary.md)
+  * [单元测试](zh-cn/unit_testing.md)
+  * [有用的功能](zh-cn/ref_functions.md)
+  * [配置器支持](zh-cn/reference_configurator_support.md)
+  * [info.json 格式](zh-cn/reference_info_json.md)
 
-* [特性](features.md)
-  * [基本键码](keycodes_basic.md)
-  * [US ANSI控制码](keycodes_us_ansi_shifted.md)
-  * [量子键码](quantum_keycodes.md)
-  * [高级键码](feature_advanced_keycodes.md)
-  * [音频](feature_audio.md)
-  * [自动shift](feature_auto_shift.md)
-  * [背光](feature_backlight.md)
-  * [蓝牙](feature_bluetooth.md)
-  * [热改键](feature_bootmagic.md)
-  * [组合](feature_combo)
-  * [命令](feature_command.md)
-  * [拨动开关](feature_dip_switch.md)
-  * [动态宏指令](feature_dynamic_macros.md)
-  * [编码器](feature_encoders.md)
-  * [重音号Esc复合键](feature_grave_esc.md)
-  * [自锁键](feature_key_lock.md)
-  * [布局](feature_layouts.md)
-  * [前导键](feature_leader_key.md)
-  * [LED阵列](feature_led_matrix.md)
-  * [宏指令](feature_macros.md)
-  * [鼠标键](feature_mouse_keys.md)
-  * [一键功能](feature_advanced_keycodes.md#one-shot-keys)
-  * [指针设备](feature_pointing_device.md)
-  * [PS/2鼠标](feature_ps2_mouse.md)
-  * [RGB灯光](feature_rgblight.md)
-  * [RGB矩阵](feature_rgb_matrix.md)
-  * [空格候补换挡](feature_space_cadet_shift.md)
-  * [空格候补换挡回车](feature_space_cadet_shift_enter.md)
-  * [速录机](feature_stenography.md)
-  * [换手](feature_swap_hands.md)
-  * [多击键](feature_tap_dance.md)
-  * [终端](feature_terminal.md)
-  * [热敏打印机](feature_thermal_printer.md)
-  * [Unicode](feature_unicode.md)
-  * [用户空间](feature_userspace.md)
-  * [速度键](feature_velocikey.md)
+* [特性](zh-cn/features.md)
+  * [基本键码](zh-cn/keycodes_basic.md)
+  * [US ANSI控制码](zh-cn/keycodes_us_ansi_shifted.md)
+  * [量子键码](zh-cn/quantum_keycodes.md)
+  * [高级键码](zh-cn/feature_advanced_keycodes.md)
+  * [音频](zh-cn/feature_audio.md)
+  * [自动shift](zh-cn/feature_auto_shift.md)
+  * [背光](zh-cn/feature_backlight.md)
+  * [蓝牙](zh-cn/feature_bluetooth.md)
+  * [热改键](zh-cn/feature_bootmagic.md)
+  * [组合](zh-cn/feature_combo)
+  * [命令](zh-cn/feature_command.md)
+  * [拨动开关](zh-cn/feature_dip_switch.md)
+  * [动态宏指令](zh-cn/feature_dynamic_macros.md)
+  * [编码器](zh-cn/feature_encoders.md)
+  * [重音号Esc复合键](zh-cn/feature_grave_esc.md)
+  * [自锁键](zh-cn/feature_key_lock.md)
+  * [布局](zh-cn/feature_layouts.md)
+  * [前导键](zh-cn/feature_leader_key.md)
+  * [LED阵列](zh-cn/feature_led_matrix.md)
+  * [宏指令](zh-cn/feature_macros.md)
+  * [鼠标键](zh-cn/feature_mouse_keys.md)
+  * [一键功能](zh-cn/feature_advanced_keycodes.md#one-shot-keys)
+  * [指针设备](zh-cn/feature_pointing_device.md)
+  * [PS/2鼠标](zh-cn/feature_ps2_mouse.md)
+  * [RGB灯光](zh-cn/feature_rgblight.md)
+  * [RGB矩阵](zh-cn/feature_rgb_matrix.md)
+  * [空格候补换挡](zh-cn/feature_space_cadet.md)
+  * [速录机](zh-cn/feature_stenography.md)
+  * [换手](zh-cn/feature_swap_hands.md)
+  * [多击键](zh-cn/feature_tap_dance.md)
+  * [终端](zh-cn/feature_terminal.md)
+  * [热敏打印机](zh-cn/feature_thermal_printer.md)
+  * [Unicode](zh-cn/feature_unicode.md)
+  * [用户空间](zh-cn/feature_userspace.md)
+  * [速度键](zh-cn/feature_velocikey.md)
 
 * 针对制造者和定制者
-  * [手工连线指南](hand_wire.md)
-  * [ISP刷新指南](isp_flashing_guide.md)
-  * [ARM调试指南](arm_debugging.md)
-  * [I2C驱动](i2c_driver.md)
-  * [GPIO控制器](internals_gpio_control.md)
-  * [Proton C转换](proton_c_conversion.md)
+  * [手工连线指南](zh-cn/hand_wire.md)
+  * [ISP刷新指南](zh-cn/isp_flashing_guide.md)
+  * [ARM调试指南](zh-cn/arm_debugging.md)
+  * [I2C驱动](zh-cn/i2c_driver.md)
+  * [GPIO控制器](zh-cn/internals_gpio_control.md)
+  * [Proton C转换](zh-cn/proton_c_conversion.md)
 
 * 深入了解
-  * [键盘如何工作](how_keyboards_work.md)
-  * [理解QMK](understanding_qmk.md)
+  * [键盘如何工作](zh-cn/how_keyboards_work.md)
+  * [理解QMK](zh-cn/understanding_qmk.md)
 
 * 其他话题
-  * [使用Eclipse开发QMK](other_eclipse.md)
-  * [使用VSCode开发QMK](other_vscode.md)
-  * [支持](support.md)
+  * [使用Eclipse开发QMK](zh-cn/other_eclipse.md)
+  * [使用VSCode开发QMK](zh-cn/other_vscode.md)
+  * [支持](zh-cn/support.md)
 
 * QMK 内构 (正在编写)
-  * [定义](internals_defines.md)
-  * [输入回调寄存器](internals_input_callback_reg.md)
-  * [Midi设备](internals_midi_device.md)
-  * [Midi设备设置过程](internals_midi_device_setup_process.md)
-  * [Midi工具库](internals_midi_util.md)
-  * [发送函数](internals_send_functions.md)
-  * [Sysex工具](internals_sysex_tools.md)
+  * [定义](zh-cn/internals_defines.md)
+  * [输入回调寄存器](zh-cn/internals_input_callback_reg.md)
+  * [Midi设备](zh-cn/internals_midi_device.md)
+  * [Midi设备设置过程](zh-cn/internals_midi_device_setup_process.md)
+  * [Midi工具库](zh-cn/internals_midi_util.md)
+  * [发送函数](zh-cn/internals_send_functions.md)
+  * [Sysex工具](zh-cn/internals_sysex_tools.md)

+ 0 - 32
docs/zh/README.md

@@ -1,32 +0,0 @@
-# QMK鍵盤固件
-
-[![當前版本](https://img.shields.io/github/tag/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/tags)
-[![築邦](https://travis-ci.org/qmk/qmk_firmware.svg?branch=master)](https://travis-ci.org/qmk/qmk_firmware)
-[![不和諧](https://img.shields.io/discord/440868230475677696.svg)](https://discord.gg/Uq7gcHh)
-[![文檔狀態](https://img.shields.io/badge/docs-ready-orange.svg)](https://docs.qmk.fm)
-[![GitHub的貢獻者](https://img.shields.io/github/contributors/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/pulse/monthly)
-[![GitHub的叉](https://img.shields.io/github/forks/qmk/qmk_firmware.svg?style=social&label=Fork)](https://github.com/qmk/qmk_firmware/)
-
-## 什麼是QMK固件?
-
-QMK是一個由社群維護的開源鍵盤韌體,其中包含了QMK Toolbox、qmk.fm和其它文件。QMK韌體是以[tmk\_keyboard](http://github.com/tmk/tmk_keyboard)為基礎,讓一些有用的功能在Atmel AVR控制器實現,使用於[OLKB](https://olkb.com)、[ergodox EZ](http://www.ergodox-ez.com),和[Clueboard](http://clueboard.co/)的產品中。它也被移植到使用ChibiOS的ARM晶片上。你也可以用它來讓你徒手佈線,或是客製的鍵盤PCB發揮功能。
-
-## 如何得到QMK
-
-如果你打算貢獻鍵盤佈局,鍵盤或功能QMK,最容易做的事情是[叉通過Github上爬行](https://github.com/qmk/qmk_firmware#fork-destination-box),和克隆你爬在本地進行更改,推動他們,然後打開從你的叉子[拉請求](https://github.com/qmk/qmk_firmware/pulls)。
-
-否則,您可以直接下載([拉鍊](https://github.com/qmk/qmk_firmware/zipball/master) [焦油](https://github.com/qmk/qmk_firmware/tarball/master)),或者通過GIT中克隆它(`git@github.com:qmk/qmk_firmware.git`)或HTTP(`https://github.com/qmk/qmk_firmware.git`)。
-
-## 如何編譯
-
-你可以編譯之前,你需要[安裝環境](getting_started_build_tools.md)用於AVR或/和ARM開發。一旦完成,你會使用`make`命令建立一個鍵盤並用以下符號鍵盤佈局
-
-    make planck/rev4:default
-
-這將建立`rev4` `planck`的修訂與`default`鍵盤映射。並非所有鍵盤有一個修訂版(也稱為子項目或文件夾),在這種情況下,它可以被省略:
-
-    make preonic:default
-
-## 如何赶近
-
-QMK有很多[特點](features.md)探索和很好的協議[參考文獻](http://docs.qmk.fm)挖通的。大部分功能通過修改[鍵盤映射(keymap.md),並改變[鍵碼](keycodes.md)冤大頭。

+ 0 - 99
docs/zh/_summary.md

@@ -1,99 +0,0 @@
-* [完全指南菜鳥](zh/newbs.md)
-  * [入門](zh/newbs_getting_started.md)
-  * [構建第一個固件](zh/newbs_building_firmware.md)
-  * [刷新固件](zh/newbs_flashing.md)
-  * [測試和調試](zh/newbs_testing_debugging.md)
-  * [最佳實踐](zh/newbs_best_practices.md)
-  * [學習資源](zh/newbs_learn_more_resources.md)
-
-* [QMK基礎](zh/README.md)
-  * [QMK簡介](zh/getting_started_introduction.md)
-  * [特約QMK](zh/contributing.md)
-  * [如何使用Github上](zh/getting_started_github.md)
-  * [獲得幫助](zh/getting_started_getting_help.md)
-
-* [常問問題](zh/faq.md)
-  * [常問問題](zh/faq_general.md)
-  * [構建/編譯QMK](zh/faq_build.md)
-  * [調試/故障排除QMK](zh/faq_debug.md)
-  * [鍵盤佈局](zh/faq_keymap.md)
-
-* 詳細指南
-  * [安裝編譯工具](zh/getting_started_build_tools.md)
-  * [流浪漢指南](zh/getting_started_vagrant.md)
-  * [構建/編譯器指令](zh/getting_started_make_guide.md)
-  * [刷新固件](zh/flashing.md)
-  * [定制功能](zh/custom_quantum_functions.md)
-  * [鍵盤映射概述](zh/keymap.md)
-
-* [硬件](zh/hardware.md)
-  * [AVR處理器](zh/hardware_avr.md)
-  * [司機](zh/hardware_drivers.md)
-
-* 參考
-  * [Keyboard Guidelines](zh/hardware_keyboard_guidelines.md)
-  * [Config Options](zh/config_options.md)
-  * [Keycodes](zh/keycodes.md)
-  * [Documentation Best Practices](zh/documentation_best_practices.md)
-  * [Documentation Templates](zh/documentation_templates.md)
-  * [Glossary](zh/reference_glossary.md)
-  * [Unit Testing](zh/unit_testing.md)
-  * [Useful Functions](zh/ref_functions.md)
-  * [Configurator Support](zh/reference_configurator_support.md)
-
-* [特點](zh/features.md)
-  * [Basic Keycodes](zh/keycodes_basic.md)
-  * [Quantum Keycodes](zh/quantum_keycodes.md)
-  * [Advanced Keycodes](zh/feature_advanced_keycodes.md)
-  * [Audio](zh/feature_audio.md)
-  * [Auto Shift](zh/feature_auto_shift.md)
-  * [Backlight](zh/feature_backlight.md)
-  * [Bluetooth](zh/feature_bluetooth.md)
-  * [Bootmagic](zh/feature_bootmagic.md)
-  * [Combos](zh/feature_combo)
-  * [Command](zh/feature_command.md)
-  * [Dynamic Macros](zh/feature_dynamic_macros.md)
-  * [Encoders](zh/feature_encoders.md)
-  * [Grave Escape](zh/feature_grave_esc.md)
-  * [Key Lock](zh/feature_key_lock.md)
-  * [Layouts](zh/feature_layouts.md)
-  * [Leader Key](zh/feature_leader_key.md)
-  * [Macros](zh/feature_macros.md)
-  * [Mouse Keys](zh/feature_mouse_keys.md)
-  * [One Shot Keys](zh/feature_advanced_keycodes.md#one-shot-keys)
-  * [Pointing Device](zh/feature_pointing_device.md)
-  * [PS/2 Mouse](zh/feature_ps2_mouse.md)
-  * [RGB Lighting](zh/feature_rgblight.md)
-  * [RGB Matrix](zh/feature_rgb_matrix.md)
-  * [Space Cadet Shift](zh/feature_space_cadet_shift.md)
-  * [Space Cadet Shift Enter](zh/feature_space_cadet_shift_enter.md)
-  * [Stenography](zh/feature_stenography.md)
-  * [Swap Hands](zh/feature_swap_hands.md)
-  * [Tap Dance](zh/feature_tap_dance.md)
-  * [Terminal](zh/feature_terminal.md)
-  * [Thermal Printer](zh/feature_thermal_printer.md)
-  * [Unicode](zh/feature_unicode.md)
-  * [Userspace](zh/feature_userspace.md)
-  * [US ANSI Shifted Keys](zh/keycodes_us_ansi_shifted.md)
-
-* 對於製造商和遊戲模組
-  * [Hand Wiring Guide](zh/hand_wire.md)
-  * [ISP Flashing Guide](zh/isp_flashing_guide.md)
-  * [ARM Debugging Guide](zh/arm_debugging.md)
-  * [I2C Driver](zh/i2c_driver.md)
-
-* 為了更深入的了解
-  * [How Keyboards Work](zh/how_keyboards_work.md)
-  * [Understanding QMK](zh/understanding_qmk.md)
-
-* 其它主題
-  * [Using Eclipse with QMK](zh/eclipse.md)
-
-* QMK內部(進行中)
-  * [Defines](zh/internals_defines.md)
-  * [Input Callback Reg](zh/internals_input_callback_reg.md)
-  * [Midi Device](zh/internals_midi_device.md)
-  * [Midi Device Setup Process](zh/internals_midi_device_setup_process.md)
-  * [Midi Util](zh/internals_midi_util.md)
-  * [Send Functions](zh/internals_send_functions.md)
-  * [Sysex Tools](zh/internals_sysex_tools.md)