Skip to content

Commit 56359fc

Browse files
committed
#6 lang finished
1 parent efbd6fa commit 56359fc

File tree

15 files changed

+360
-1543
lines changed

15 files changed

+360
-1543
lines changed

.github/workflows/translate.yml

Lines changed: 44 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
name: Readme Translator (Multilingual)
1+
name: DataBoySu's Readme Translator
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
languages:
7+
description: 'Languages to translate (comma-separated, e.g., "de,fr,ja")'
8+
required: false
9+
default: 'de,fr,es,ja,zh,ru,pt,ko,hi'
510
push:
611
paths:
712
- 'README.md'
@@ -10,14 +15,32 @@ permissions:
1015
contents: write
1116

1217
jobs:
13-
# JOB 1: Western Languages (Faster, ~11 mins)
14-
translate-western:
15-
name: Western (${{ matrix.lang }})
18+
prepare-matrix:
19+
name: Prepare Translation Matrix
20+
runs-on: ubuntu-latest
21+
outputs:
22+
languages: ${{ steps.set-matrix.outputs.languages }}
23+
steps:
24+
- id: set-matrix
25+
run: |
26+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
27+
# Manual trigger: use user input
28+
LANGS="${{ github.event.inputs.languages }}"
29+
else
30+
# Auto trigger: use default languages
31+
LANGS="de,fr,es,ja,zh,ru,pt,ko,hi"
32+
fi
33+
# Convert comma-separated string to JSON array
34+
echo "languages=$(echo $LANGS | jq -R -c 'split(",")')" >> $GITHUB_OUTPUT
35+
36+
translate:
37+
name: Translate (${{ matrix.lang }})
38+
needs: prepare-matrix
1639
runs-on: ubuntu-latest
1740
strategy:
18-
fail-fast: false # If one language fails, let the others finish
41+
fail-fast: false
1942
matrix:
20-
lang: [de, fr, es, pt] # German, French, Spanish, Portuguese
43+
lang: ${{ fromJson(needs.prepare-matrix.outputs.languages) }}
2144
steps:
2245
- name: Checkout Code
2346
uses: actions/checkout@v4
@@ -34,118 +57,51 @@ jobs:
3457
uses: actions/cache@v4
3558
with:
3659
path: ./models
37-
key: aya-expanse-8b-q4ks-v4
60+
key: aya-expanse-8b-q4km-v1
3861

3962
- name: Install Dependencies
4063
run: |
4164
pip install llama-cpp-python
4265
mkdir -p models
4366
44-
- name: Download Aya Expanse Translation Model
67+
- name: Download Aya Expanse 8B Model
4568
if: steps.cache-model.outputs.cache-hit != 'true'
4669
run: |
47-
# Downloading Aya Expanse 8B (Q4_K_S) for multilingual technical translation
48-
wget -O models/aya-expanse-8b-q4_k_s.gguf https://huggingface.co/matrixportalx/aya-expanse-8b-Q4_K_S-GGUF/resolve/main/aya-expanse-8b-q4_k_s.gguf
70+
# Aya Expanse 8B (Q4_K_M) - Optimized for multilingual technical translation
71+
wget -O models/aya-expanse-8b-Q4_K_M.gguf https://huggingface.co/lmstudio-community/aya-expanse-8b-GGUF/resolve/main/aya-expanse-8b-Q4_K_M.gguf
4972
5073
- name: Run Translation Script
51-
run: python scripts/translate_western.py --lang ${{ matrix.lang }}
74+
run: python scripts/translate.py --lang ${{ matrix.lang }}
5275

5376
- name: Upload Translation Artifact
5477
uses: actions/upload-artifact@v4
5578
with:
56-
name: western-readme-${{ matrix.lang }}
79+
name: readme-${{ matrix.lang }}
5780
path: locales/README.${{ matrix.lang }}.md
5881

59-
commit-western:
60-
needs: translate-western
82+
commit:
83+
name: Commit Translations
84+
needs: translate
6185
runs-on: ubuntu-latest
6286
steps:
6387
- name: Checkout Code
6488
uses: actions/checkout@v4
6589

66-
- name: Download Western Translations
90+
- name: Download All Translations
6791
uses: actions/download-artifact@v4
6892
with:
69-
pattern: western-readme-*
93+
pattern: readme-*
7094
path: locales
7195
merge-multiple: true
7296

73-
- name: Commit and Push (Western)
97+
- name: Commit and Push
7498
run: |
75-
git config --global user.name "github-actions[bot]"
99+
git config --global user.name "DataBoySu's Readme Translator"
76100
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
77101
git add locales/*.md
78-
git commit -m "docs: update western translations (DE, FR, ES, PT)" || echo "No changes to commit"
102+
git commit -m "docs: update translations" || echo "No changes to commit"
79103
80-
# Retry logic to handle race conditions if Eastern finishes at the same time
81-
for i in {1..5}; do
82-
git pull --rebase
83-
if git push; then exit 0; fi
84-
echo "Push failed, retrying in 5s..."
85-
sleep 5
86-
done
87-
exit 1
88-
89-
# JOB 2: Eastern/Complex Languages (Slower, ~17 mins)
90-
translate-eastern:
91-
name: Eastern (${{ matrix.lang }})
92-
runs-on: ubuntu-latest
93-
strategy:
94-
fail-fast: false
95-
matrix:
96-
lang: [ja, zh, ko, hi] # Japanese, Chinese, Korean, Hindi
97-
steps:
98-
- name: Checkout Code
99-
uses: actions/checkout@v4
100-
with:
101-
fetch-depth: 0
102-
- name: Set up Python
103-
uses: actions/setup-python@v5
104-
with:
105-
python-version: '3.10'
106-
- name: Cache Model Weights
107-
id: cache-model
108-
uses: actions/cache@v4
109-
with:
110-
path: ./models
111-
key: aya-expanse-8b-q4ks-v4
112-
- name: Install Dependencies
113-
run: |
114-
pip install llama-cpp-python
115-
mkdir -p models
116-
- name: Download Aya Expanse TL Model
117-
if: steps.cache-model.outputs.cache-hit != 'true'
118-
run: |
119-
# Downloading Aya Expanse 8B (Q4_K_S) for multilingual technical translation
120-
wget -O models/aya-expanse-8b-q4_k_s.gguf https://huggingface.co/matrixportalx/aya-expanse-8b-Q4_K_S-GGUF/resolve/main/aya-expanse-8b-q4_k_s.gguf
121-
122-
- name: Run Translation Script
123-
run: python scripts/translate_eastern.py --lang ${{ matrix.lang }}
124-
125-
- name: Upload Translation Artifact
126-
uses: actions/upload-artifact@v4
127-
with:
128-
name: eastern-readme-${{ matrix.lang }}
129-
path: locales/README.${{ matrix.lang }}.md
130-
131-
commit-eastern:
132-
needs: translate-eastern
133-
runs-on: ubuntu-latest
134-
steps:
135-
- name: Checkout Code
136-
uses: actions/checkout@v4
137-
- name: Download Eastern Translations
138-
uses: actions/download-artifact@v4
139-
with:
140-
pattern: eastern-readme-*
141-
path: locales
142-
merge-multiple: true
143-
- name: Commit and Push (Eastern)
144-
run: |
145-
git config --global user.name "github-actions[bot]"
146-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
147-
git add locales/*.md
148-
git commit -m "docs: update eastern translations (JA, ZH, KO, HI)" || echo "No changes to commit"
104+
# Retry logic for concurrent pushes
149105
for i in {1..5}; do
150106
git pull --rebase
151107
if git push; then exit 0; fi

locales/README.de.md

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)