fix bugs

Update translations for all languages [2025-01-22]

i18n

Update translations for all languages [2025-01-18]

Update i18n.yml

Update translations for all languages [2025-01-18]

Update translate.py

Update translations for all languages [2025-01-17]

fix version file

Update translations for all languages [2025-01-17]

Update install.sh

Update translations for all languages [2025-01-17]

fix translation

Update translations for all languages [2025-01-15]

fix bugs

Update translations for all languages [2025-01-15]
This commit is contained in:
paniy
2025-01-16 00:53:21 +08:00
committed by yunshu
parent e386b927f6
commit f6f35de900
28 changed files with 5436 additions and 4969 deletions
+22
View File
@@ -0,0 +1,22 @@
name: Cleanup Workflow Runs
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
del_runs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 14
keep_minimum_runs: 10
+36 -26
View File
@@ -26,6 +26,8 @@ jobs:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
with:
persist-credentials: true
- name: Restore translation cache
id: cache-translations
@@ -39,20 +41,27 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext python3 python3-pip
pip3 install googletrans-py
sudo apt-get install -y gettext python3 python3-pip i18nspector
pip3 install googletrans-py langdetect
- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-googletrans-py-langdetect
restore-keys: |
${{ runner.os }}-pip-
- name: Setup directories
run: |
mkdir -p po
mkdir -p languages/{en,fa,ru,zh_CN}/LC_MESSAGES
- name: Extract strings from all scripts
- name: Extract strings from specified scripts
run: |
touch po/POTFILES.in
for script in install.sh auto_update.sh fail2ban_manager.sh file_manager.sh; do
echo "$script" >> po/POTFILES.in
done
echo "install.sh" > po/POTFILES.in
echo "fail2ban_manager.sh" >> po/POTFILES.in
echo "file_manager.sh" >> po/POTFILES.in
xgettext \
--files-from=po/POTFILES.in \
@@ -67,17 +76,31 @@ jobs:
- name: Update/Create PO files
run: |
rm -f po/*.po
for lang in zh_CN en fa ru; do
if [ ! -f po/$lang.po ]; then
msginit --no-translator --locale=$lang --input=po/xray_install.pot --output=po/$lang.po
else
msgmerge --update --backup=none po/$lang.po po/xray_install.pot
fi
msginit --no-translator --locale=$lang --input=po/xray_install.pot --output=po/$lang.po
done
- name: Auto translate
run: python3 translate.py
- name: Compile MO files
run: |
#cat po/en.po
for lang in zh_CN en fa ru; do
msgfmt --check -v --statistics -o languages/${lang}/LC_MESSAGES/xray_install.mo po/${lang}.po
done
- name: Run i18nspector checks on PO files
run: |
i18nspector check po/
- name: Run i18nspector checks on MO files
run: |
for lang in zh_CN en fa ru; do
i18nspector check-binary languages/${lang}/LC_MESSAGES/xray_install.mo
done
- name: Save translation cache
if: always()
uses: actions/cache@v3
@@ -85,19 +108,6 @@ jobs:
path: po/cache_*.json
key: ${{ runner.os }}-translations-${{ hashFiles('po/*.po') }}
- name: Compile MO files
run: |
for lang in zh_CN en fa ru; do
msgfmt -o languages/${lang}/LC_MESSAGES/xray_install.mo po/${lang}.po
done
- name: Create version file
run: |
TIMESTAMP=$(date +%s)
for lang in zh_CN en fa ru; do
echo "$TIMESTAMP" > languages/${lang}/LC_MESSAGES/version
done
- name: Pull changes
run: |
git pull origin main
+61
View File
@@ -0,0 +1,61 @@
name: Translate README
on:
push:
paths:
- 'README.md'
branches:
- main
workflow_dispatch:
jobs:
translate-readme:
runs-on: ubuntu-latest
steps:
- name: Check running workflows
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
with:
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext
pip install --upgrade pip
pip install googletrans==4.0.0-rc1 langdetect markdown beautifulsoup4
# 确保使用具体版本,避免兼容性问题
- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/translate_readme.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Translate README
run: python3 translate_readme.py README.md languages/
- name: Pull changes
run: |
git pull origin main
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add languages/
git commit -m "Update translations for README [$(date +%Y-%m-%d)]" || echo "No changes to commit"
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:main