Skip to content

Commit 4f47b06

Browse files
committed
translators
1 parent 40a081b commit 4f47b06

18 files changed

+238
-811
lines changed

.github/workflows/translate_af.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ jobs:
2121
run-translation:
2222
runs-on: ubuntu-latest
2323
container:
24-
# Use the image you pushed to GHCR
2524
image: ghcr.io/HackTricks-wiki/hacktricks-cloud/translator-image:latest
25+
environment: prod
26+
env:
27+
LANGUAGE: Afrikaans
28+
BRANCH: af
2629

2730
steps:
2831
- name: Checkout code

.github/workflows/translate_de.yml

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- 'scripts/**'
99
- '.gitignore'
1010
- '.github/**'
11+
- Dockerfile
1112
workflow_dispatch:
1213

1314
concurrency: de
@@ -19,93 +20,54 @@ permissions:
1920
jobs:
2021
run-translation:
2122
runs-on: ubuntu-latest
23+
container:
24+
image: ghcr.io/HackTricks-wiki/hacktricks-cloud/translator-image:latest
2225
environment: prod
2326
env:
2427
LANGUAGE: German
2528
BRANCH: de
26-
29+
2730
steps:
2831
- name: Checkout code
2932
uses: actions/checkout@v2
3033
with:
31-
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
32-
33-
- name: Set up Python
34-
uses: actions/setup-python@v2
35-
with:
36-
python-version: 3.12
37-
38-
- name: Install python dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip3 install openai tqdm tiktoken
42-
43-
# Install Rust and Cargo
44-
- name: Install Rust and Cargo
45-
uses: actions-rs/toolchain@v1
46-
with:
47-
toolchain: stable
48-
override: true
49-
50-
# Install mdBook and Plugins
51-
- name: Install mdBook and Plugins
52-
run: |
53-
cargo install mdbook
54-
cargo install mdbook-alerts
55-
cargo install mdbook-reading-time
56-
cargo install mdbook-pagetoc
57-
cargo install mdbook-tabs
58-
cargo install mdbook-codename
59-
34+
fetch-depth: 0
6035

61-
- name: Update & install wget & translator.py
36+
- name: Update & install translator.py (if needed)
6237
run: |
63-
sudo apt-get update
64-
sudo apt-get install wget -y
6538
cd scripts
6639
rm -f translator.py
6740
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
6841
cd ..
69-
70-
- name: Download language branch #Make sure we have last version
42+
43+
- name: Download language branch
7144
run: |
7245
git config --global user.name 'Translator'
7346
git config --global user.email '[email protected]'
74-
git checkout "$BRANCH"
47+
git checkout af
7548
git pull
7649
git checkout master
7750
7851
- name: Run translation script on changed files
7952
run: |
80-
echo "Starting translations"
81-
echo "Commit: $GITHUB_SHA"
82-
83-
# Export the OpenAI API key as an environment variable
8453
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
85-
86-
# Run the translation script on each changed file
8754
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
8855
if echo "$file" | grep -qE '\.md$'; then
8956
echo -n "$file , " >> /tmp/file_paths.txt
90-
else
91-
echo "Skipping $file"
9257
fi
9358
done
59+
python scripts/translator.py --language "Afrikaans" --branch "af" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
9460
95-
echo "Translating $(cat /tmp/file_paths.txt)"
96-
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
97-
98-
# Push changes to the repository
9961
- name: Commit and push changes
10062
run: |
101-
git checkout "$BRANCH"
63+
git checkout af
10264
git add -A
103-
git commit -m "Translated $BRANCH files" || true
104-
git push --set-upstream origin "$BRANCH"
65+
git commit -m "Translated Afrikaans files" || true
66+
git push --set-upstream origin af
10567
106-
# Build the mdBook
10768
- name: Build mdBook
108-
run: MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1)
69+
run: |
70+
MDBOOK_BOOK__LANGUAGE=af mdbook build || (cat hacktricks-preprocessor-error.log && exit 1)
10971
11072
# Login in AWs
11173
- name: Configure AWS credentials using OIDC

.github/workflows/translate_el.yml

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- 'scripts/**'
99
- '.gitignore'
1010
- '.github/**'
11+
- Dockerfile
1112
workflow_dispatch:
1213

1314
concurrency: el
@@ -19,93 +20,54 @@ permissions:
1920
jobs:
2021
run-translation:
2122
runs-on: ubuntu-latest
23+
container:
24+
image: ghcr.io/HackTricks-wiki/hacktricks-cloud/translator-image:latest
2225
environment: prod
2326
env:
2427
LANGUAGE: Greek
2528
BRANCH: el
26-
29+
2730
steps:
2831
- name: Checkout code
2932
uses: actions/checkout@v2
3033
with:
31-
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
32-
33-
- name: Set up Python
34-
uses: actions/setup-python@v2
35-
with:
36-
python-version: 3.12
37-
38-
- name: Install python dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip3 install openai tqdm tiktoken
42-
43-
# Install Rust and Cargo
44-
- name: Install Rust and Cargo
45-
uses: actions-rs/toolchain@v1
46-
with:
47-
toolchain: stable
48-
override: true
49-
50-
# Install mdBook and Plugins
51-
- name: Install mdBook and Plugins
52-
run: |
53-
cargo install mdbook
54-
cargo install mdbook-alerts
55-
cargo install mdbook-reading-time
56-
cargo install mdbook-pagetoc
57-
cargo install mdbook-tabs
58-
cargo install mdbook-codename
59-
34+
fetch-depth: 0
6035

61-
- name: Update & install wget & translator.py
36+
- name: Update & install translator.py (if needed)
6237
run: |
63-
sudo apt-get update
64-
sudo apt-get install wget -y
6538
cd scripts
6639
rm -f translator.py
6740
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
6841
cd ..
69-
70-
- name: Download language branch #Make sure we have last version
42+
43+
- name: Download language branch
7144
run: |
7245
git config --global user.name 'Translator'
7346
git config --global user.email '[email protected]'
74-
git checkout "$BRANCH"
47+
git checkout af
7548
git pull
7649
git checkout master
7750
7851
- name: Run translation script on changed files
7952
run: |
80-
echo "Starting translations"
81-
echo "Commit: $GITHUB_SHA"
82-
83-
# Export the OpenAI API key as an environment variable
8453
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
85-
86-
# Run the translation script on each changed file
8754
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
8855
if echo "$file" | grep -qE '\.md$'; then
8956
echo -n "$file , " >> /tmp/file_paths.txt
90-
else
91-
echo "Skipping $file"
9257
fi
9358
done
59+
python scripts/translator.py --language "Afrikaans" --branch "af" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
9460
95-
echo "Translating $(cat /tmp/file_paths.txt)"
96-
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
97-
98-
# Push changes to the repository
9961
- name: Commit and push changes
10062
run: |
101-
git checkout "$BRANCH"
63+
git checkout af
10264
git add -A
103-
git commit -m "Translated $BRANCH files" || true
104-
git push --set-upstream origin "$BRANCH"
65+
git commit -m "Translated Afrikaans files" || true
66+
git push --set-upstream origin af
10567
106-
# Build the mdBook
10768
- name: Build mdBook
108-
run: MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1)
69+
run: |
70+
MDBOOK_BOOK__LANGUAGE=af mdbook build || (cat hacktricks-preprocessor-error.log && exit 1)
10971
11072
# Login in AWs
11173
- name: Configure AWS credentials using OIDC
@@ -116,4 +78,4 @@ jobs:
11678

11779
# Sync the build to S3
11880
- name: Sync to S3
119-
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete
81+
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete

.github/workflows/translate_es.yml

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- 'scripts/**'
99
- '.gitignore'
1010
- '.github/**'
11+
- Dockerfile
1112
workflow_dispatch:
1213

1314
concurrency: es
@@ -19,93 +20,54 @@ permissions:
1920
jobs:
2021
run-translation:
2122
runs-on: ubuntu-latest
23+
container:
24+
image: ghcr.io/HackTricks-wiki/hacktricks-cloud/translator-image:latest
2225
environment: prod
2326
env:
2427
LANGUAGE: Spanish
2528
BRANCH: es
26-
29+
2730
steps:
2831
- name: Checkout code
2932
uses: actions/checkout@v2
3033
with:
31-
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
32-
33-
- name: Set up Python
34-
uses: actions/setup-python@v2
35-
with:
36-
python-version: 3.12
37-
38-
- name: Install python dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip3 install openai tqdm tiktoken
42-
43-
# Install Rust and Cargo
44-
- name: Install Rust and Cargo
45-
uses: actions-rs/toolchain@v1
46-
with:
47-
toolchain: stable
48-
override: true
49-
50-
# Install mdBook and Plugins
51-
- name: Install mdBook and Plugins
52-
run: |
53-
cargo install mdbook
54-
cargo install mdbook-alerts
55-
cargo install mdbook-reading-time
56-
cargo install mdbook-pagetoc
57-
cargo install mdbook-tabs
58-
cargo install mdbook-codename
59-
34+
fetch-depth: 0
6035

61-
- name: Update & install wget & translator.py
36+
- name: Update & install translator.py (if needed)
6237
run: |
63-
sudo apt-get update
64-
sudo apt-get install wget -y
6538
cd scripts
6639
rm -f translator.py
6740
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
6841
cd ..
69-
70-
- name: Download language branch #Make sure we have last version
42+
43+
- name: Download language branch
7144
run: |
7245
git config --global user.name 'Translator'
7346
git config --global user.email '[email protected]'
74-
git checkout "$BRANCH"
47+
git checkout af
7548
git pull
7649
git checkout master
7750
7851
- name: Run translation script on changed files
7952
run: |
80-
echo "Starting translations"
81-
echo "Commit: $GITHUB_SHA"
82-
83-
# Export the OpenAI API key as an environment variable
8453
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
85-
86-
# Run the translation script on each changed file
8754
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
8855
if echo "$file" | grep -qE '\.md$'; then
8956
echo -n "$file , " >> /tmp/file_paths.txt
90-
else
91-
echo "Skipping $file"
9257
fi
9358
done
59+
python scripts/translator.py --language "Afrikaans" --branch "af" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
9460
95-
echo "Translating $(cat /tmp/file_paths.txt)"
96-
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
97-
98-
# Push changes to the repository
9961
- name: Commit and push changes
10062
run: |
101-
git checkout "$BRANCH"
63+
git checkout af
10264
git add -A
103-
git commit -m "Translated $BRANCH files" || true
104-
git push --set-upstream origin "$BRANCH"
65+
git commit -m "Translated Afrikaans files" || true
66+
git push --set-upstream origin af
10567
106-
# Build the mdBook
10768
- name: Build mdBook
108-
run: MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1)
69+
run: |
70+
MDBOOK_BOOK__LANGUAGE=af mdbook build || (cat hacktricks-preprocessor-error.log && exit 1)
10971
11072
# Login in AWs
11173
- name: Configure AWS credentials using OIDC

0 commit comments

Comments
 (0)