Skip to content

Commit

Permalink
Expose zh-cn docs, delete bad zh docs, add docs for adding translatio…
Browse files Browse the repository at this point in the history
…ns (qmk#6855)

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

* Update docs/translating.md

Co-Authored-By: noroadsleft <[email protected]>

* Update docs/translating.md

Co-Authored-By: noroadsleft <[email protected]>

* update for python 3
  • Loading branch information
jackhumbert authored and HokieGeek committed Feb 21, 2020
1 parent 81881bb commit b06cfca
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 230 deletions.
4 changes: 0 additions & 4 deletions docs/LANGS.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/_langs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Translations
- [:uk: English](/)
- [:cn: 中文](/zh-cn/)
1 change: 1 addition & 0 deletions docs/_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
40 changes: 36 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
Expand Down
29 changes: 29 additions & 0 deletions docs/translating.md
Original file line number Diff line number Diff line change
@@ -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!
181 changes: 90 additions & 91 deletions docs/zh-cn/_summary.md
Original file line number Diff line number Diff line change
@@ -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)
32 changes: 0 additions & 32 deletions docs/zh/README.md

This file was deleted.

Loading

0 comments on commit b06cfca

Please sign in to comment.