-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (68 loc) · 3.33 KB
/
Copy pathtranslate-readme.yml
File metadata and controls
78 lines (68 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Translate README
on:
push:
branches: [master, main]
paths:
- 'README.md'
jobs:
translate:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Translate to Chinese (zh-CN)
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
run: |
cat > /tmp/system_zh.txt << 'SYSEOF'
你是一个专业的技术文档翻译。将以下Markdown内容翻译为简体中文。
规则:
1. 保留所有Markdown格式、链接URL、代码块、HTML标签、badge图片链接完全不变
2. 技术术语保持英文(如npm、Node.js、API、GitHub、OpenCode、agentmemory、npx、plugin等)
3. 只翻译自然语言文本(标题、描述、说明文字)
4. 保持原文的文档结构和层级
5. 代码块内的内容完全不翻译
6. 表格内容翻译,但保持表格结构
7. 不要添加任何额外说明或注释
SYSEOF
jq -n \
--rawfile system /tmp/system_zh.txt \
--rawfile content README.md \
'{model: "deepseek-v4-flash", messages: [{role: "system", content: $system}, {role: "user", content: $content}]}' \
| curl -s https://api.deepseek.com/beta/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d @- \
| jq -r '.choices[0].message.content' > docs/README.zh.md
- name: Translate to French (fr)
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
run: |
cat > /tmp/system_fr.txt << 'FREOF'
Tu es un traducteur technique professionnel. Traduis le contenu Markdown suivant en français.
Règles :
1. Conserve TOUS les formats Markdown, URLs de liens, blocs de code, balises HTML et liens de badges exactement tels quels
2. Garde les termes techniques en anglais (npm, Node.js, API, GitHub, OpenCode, agentmemory, npx, plugin, etc.)
3. Traduis uniquement le texte en langage naturel (titres, descriptions, texte explicatif)
4. Conserve la structure et la hiérarchie du document original
5. Ne traduis JAMAIS le contenu à l'intérieur des blocs de code
6. Traduis le contenu des tableaux mais garde leur structure
7. N'ajoute aucune note ou commentaire supplémentaire
FREOF
jq -n \
--rawfile system /tmp/system_fr.txt \
--rawfile content README.md \
'{model: "deepseek-v4-flash", messages: [{role: "system", content: $system}, {role: "user", content: $content}]}' \
| curl -s https://api.deepseek.com/beta/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d @- \
| jq -r '.choices[0].message.content' > docs/README.fr.md
- name: Commit and push translations
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/README.zh.md docs/README.fr.md
git diff --staged --quiet || git commit -m "docs: auto-translate README to zh/fr [skip ci]"
git push