aboutsummaryrefslogtreecommitdiff
path: root/docs/add_translation.py
diff options
context:
space:
mode:
author100ask <48745717+100ask@users.noreply.github.com>2024-03-15 10:25:41 +0800
committerGitHub <noreply@github.com>2024-03-15 10:25:41 +0800
commit3fa4d29714d72a777fe1b67d56ebc36bf1bc66c4 (patch)
treeb764171841179f1e5e55edbace0b579763104aba /docs/add_translation.py
parentd9da34aebe1f46ad0f7ca45fbb26b696175c9c8e (diff)
downloadlvgl-3fa4d29714d72a777fe1b67d56ebc36bf1bc66c4.tar.gz
lvgl-3fa4d29714d72a777fe1b67d56ebc36bf1bc66c4.zip
docs: make it easy to add more other translations (#5874)
Co-authored-by: YobeZhou <smilezyb@163.com>
Diffstat (limited to 'docs/add_translation.py')
-rwxr-xr-xdocs/add_translation.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/add_translation.py b/docs/add_translation.py
index 3b25fd904..27c85d3aa 100755
--- a/docs/add_translation.py
+++ b/docs/add_translation.py
@@ -1,6 +1,25 @@
#!/usr/bin/env python3
import os
+"""
+Please add the translation language you want to add here, while also modifying the variable URL_BASE in _ext/link_roles.py
+For example:
+
+LANGUAGE = ':link_to_translation:`zh_CN:[中文]`\t' + \
+ ':link_to_translation:`en:[English]`\t' + \
+ '\n\n'
+
+
+URL_BASE = {
+ "zh_CN": "https://lvgl.100ask.net/",
+ "en": "https://docs.lvgl.io/"
+}
+"""
+
+LANGUAGE = ':link_to_translation:`zh_CN:[中文]`\t' + \
+ '\n\n'
+
+
def find_files(dir_path, suffix):
files = []
@@ -20,4 +39,4 @@ def exec(temp_directory):
with open(rst_file, 'r+', encoding='utf-8') as f:
content = f.read()
f.seek(0, 0)
- f.write(':link_to_translation:`zh_CN:[中文]`\n\n' + content)
+ f.write(LANGUAGE + content)