mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-22 04:33:28 +00:00
translators
This commit is contained in:
parent
116e3864db
commit
cfe2830fdd
6 changed files with 486 additions and 0 deletions
81
.github/workflows/translate_de.yml
vendored
Normal file
81
.github/workflows/translate_de.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Translator to DE (German)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: de
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
env:
|
||||||
|
LANGUAGE: German
|
||||||
|
BRANCH: de
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install openai tqdm tiktoken
|
||||||
|
|
||||||
|
- name: Update & install wget & translator.py
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Download language branch #Make sure we have last version
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'Translator'
|
||||||
|
git config --global user.email 'github-actions@github.com'
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git pull
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
- name: Run translation script on changed files
|
||||||
|
run: |
|
||||||
|
echo "Starting translations"
|
||||||
|
echo "Commit: $GITHUB_SHA"
|
||||||
|
|
||||||
|
# Export the OpenAI API key as an environment variable
|
||||||
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
|
# Run the translation script on each changed file
|
||||||
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
|
else
|
||||||
|
echo "Skipping $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Translating $(cat /tmp/file_paths.txt)"
|
||||||
|
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Translated $BRANCH files" || true
|
||||||
|
git push --set-upstream origin "$BRANCH"
|
81
.github/workflows/translate_gr.yml
vendored
Normal file
81
.github/workflows/translate_gr.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Translator to GR (Greek)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: gr
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
env:
|
||||||
|
LANGUAGE: Greek
|
||||||
|
BRANCH: gr
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install openai tqdm tiktoken
|
||||||
|
|
||||||
|
- name: Update & install wget & translator.py
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Download language branch #Make sure we have last version
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'Translator'
|
||||||
|
git config --global user.email 'github-actions@github.com'
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git pull
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
- name: Run translation script on changed files
|
||||||
|
run: |
|
||||||
|
echo "Starting translations"
|
||||||
|
echo "Commit: $GITHUB_SHA"
|
||||||
|
|
||||||
|
# Export the OpenAI API key as an environment variable
|
||||||
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
|
# Run the translation script on each changed file
|
||||||
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
|
else
|
||||||
|
echo "Skipping $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Translating $(cat /tmp/file_paths.txt)"
|
||||||
|
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Translated $BRANCH files" || true
|
||||||
|
git push --set-upstream origin "$BRANCH"
|
81
.github/workflows/translate_it.yml
vendored
Normal file
81
.github/workflows/translate_it.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Translator to IT (Italian)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: rs
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
env:
|
||||||
|
LANGUAGE: Italian
|
||||||
|
BRANCH: it
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install openai tqdm tiktoken
|
||||||
|
|
||||||
|
- name: Update & install wget & translator.py
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Download language branch #Make sure we have last version
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'Translator'
|
||||||
|
git config --global user.email 'github-actions@github.com'
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git pull
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
- name: Run translation script on changed files
|
||||||
|
run: |
|
||||||
|
echo "Starting translations"
|
||||||
|
echo "Commit: $GITHUB_SHA"
|
||||||
|
|
||||||
|
# Export the OpenAI API key as an environment variable
|
||||||
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
|
# Run the translation script on each changed file
|
||||||
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
|
else
|
||||||
|
echo "Skipping $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Translating $(cat /tmp/file_paths.txt)"
|
||||||
|
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Translated $BRANCH files" || true
|
||||||
|
git push --set-upstream origin "$BRANCH"
|
81
.github/workflows/translate_kr.yml
vendored
Normal file
81
.github/workflows/translate_kr.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Translator to KR (Korean)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: kr
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
env:
|
||||||
|
LANGUAGE: Korean
|
||||||
|
BRANCH: kr
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install openai tqdm tiktoken
|
||||||
|
|
||||||
|
- name: Update & install wget & translator.py
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Download language branch #Make sure we have last version
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'Translator'
|
||||||
|
git config --global user.email 'github-actions@github.com'
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git pull
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
- name: Run translation script on changed files
|
||||||
|
run: |
|
||||||
|
echo "Starting translations"
|
||||||
|
echo "Commit: $GITHUB_SHA"
|
||||||
|
|
||||||
|
# Export the OpenAI API key as an environment variable
|
||||||
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
|
# Run the translation script on each changed file
|
||||||
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
|
else
|
||||||
|
echo "Skipping $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Translating $(cat /tmp/file_paths.txt)"
|
||||||
|
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Translated $BRANCH files" || true
|
||||||
|
git push --set-upstream origin "$BRANCH"
|
81
.github/workflows/translate_rs.yml
vendored
Normal file
81
.github/workflows/translate_rs.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Translator to RS (Serbian)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: rs
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
env:
|
||||||
|
LANGUAGE: Serbian
|
||||||
|
BRANCH: rs
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install openai tqdm tiktoken
|
||||||
|
|
||||||
|
- name: Update & install wget & translator.py
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Download language branch #Make sure we have last version
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'Translator'
|
||||||
|
git config --global user.email 'github-actions@github.com'
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git pull
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
- name: Run translation script on changed files
|
||||||
|
run: |
|
||||||
|
echo "Starting translations"
|
||||||
|
echo "Commit: $GITHUB_SHA"
|
||||||
|
|
||||||
|
# Export the OpenAI API key as an environment variable
|
||||||
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
|
# Run the translation script on each changed file
|
||||||
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
|
else
|
||||||
|
echo "Skipping $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Translating $(cat /tmp/file_paths.txt)"
|
||||||
|
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Translated $BRANCH files" || true
|
||||||
|
git push --set-upstream origin "$BRANCH"
|
81
.github/workflows/translate_tr.yml
vendored
Normal file
81
.github/workflows/translate_tr.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
name: Translator to TR (Turkish)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: tr
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
env:
|
||||||
|
LANGUAGE: Turkish
|
||||||
|
BRANCH: tr
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip3 install openai tqdm tiktoken
|
||||||
|
|
||||||
|
- name: Update & install wget & translator.py
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Download language branch #Make sure we have last version
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'Translator'
|
||||||
|
git config --global user.email 'github-actions@github.com'
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git pull
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
- name: Run translation script on changed files
|
||||||
|
run: |
|
||||||
|
echo "Starting translations"
|
||||||
|
echo "Commit: $GITHUB_SHA"
|
||||||
|
|
||||||
|
# Export the OpenAI API key as an environment variable
|
||||||
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
|
# Run the translation script on each changed file
|
||||||
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
|
else
|
||||||
|
echo "Skipping $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Translating $(cat /tmp/file_paths.txt)"
|
||||||
|
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git checkout "$BRANCH"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Translated $BRANCH files" || true
|
||||||
|
git push --set-upstream origin "$BRANCH"
|
Loading…
Reference in a new issue