diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml new file mode 100644 index 000000000..f1f4919dc --- /dev/null +++ b/.github/workflows/translations.yml @@ -0,0 +1,33 @@ +name: Translations + +on: + pull_request: + paths: + - 'app/src/main/res/**/strings.xml' + - 'crowdin.yml' + - 'scripts/check_translations.py' + - '.github/workflows/translations.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Check translation formats and regressions + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: | + if [ -n "$BASE_SHA" ]; then + python scripts/check_translations.py --base "$BASE_SHA" + else + python scripts/check_translations.py + fi diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 311690ba3..a91376724 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -3359,7 +3359,7 @@ Anwenden Profil angewendet Automatisch anwenden, wenn dieses Gerät wieder verbunden wird - Auto EQ wiederhergestellt: %1 + Auto EQ wiederhergestellt: %1$s Profil entfernen Profile von AutoEq, basierend auf oratory1990, crinacle, Rtings und Squiglink. EQ importieren diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 033a4fc41..100afc561 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -3348,7 +3348,7 @@ Alkalmaz Profil alkalmazva Automatikus alkalmazás az eszköz újracsatlakozásakor - Auto EQ visszaállítva: %1 + Auto EQ visszaállítva: %1$s Profil eltávolítása Profilok az AutoEq-ból, oratory1990, crinacle, Rtings és Squiglink mérések alapján. EQ importálása diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index d4694bcb0..b40b777a1 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -3362,7 +3362,7 @@ Применить Профиль применен Применять автоматически при повторном подключении - Auto EQ восстановлен: %1 + Auto EQ восстановлен: %1$s Удалить профиль Профили из AutoEq, на основе измерений oratory1990, crinacle, Rtings и Squiglink. Импорт EQ diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 87fbf9ef5..70c518dda 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -3344,7 +3344,7 @@ Áp dụng Đã áp dụng cấu hình Tự động áp dụng khi thiết bị này kết nối lại - Đã khôi phục Auto EQ: %1 + Đã khôi phục Auto EQ: %1$s Xóa cấu hình Cấu hình từ AutoEq, dựa trên đo kiểm của oratory1990, crinacle, Rtings và Squiglink. Nhập EQ diff --git a/crowdin.yml b/crowdin.yml index 6a2f2e085..78c3d9b32 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -10,8 +10,23 @@ base_path: "." preserve_hierarchy: true +# Crowdin's default [ci skip] would bypass translation validation on PRs. +append_commit_message: false +commit_message: "i18n: update %original_file_name% (%language%)" + +# Export only the locales currently supported by the app. +export_languages: [de, fr, hu, pt-BR, ru, tr, vi] + files: - source: /app/src/main/res/values/strings.xml translation: /app/src/main/res/values-%android_code%/strings.xml - # If the language code is something like 'zh-CN', Android needs 'zh-rCN' or similar. - # Crowdin's GitHub integration usually handles Android locales automatically. + # Match the shipped resource paths; regional copies override these on Android. + languages_mapping: + android_code: + de: de + fr: fr + hu: hu + pt-BR: pt-rBR + ru: ru + tr: tr + vi: vi diff --git a/scripts/check_translations.py b/scripts/check_translations.py new file mode 100644 index 000000000..e041976bf --- /dev/null +++ b/scripts/check_translations.py @@ -0,0 +1,95 @@ +"""Check Android string formats and prevent English fallback regressions. + +Run from any directory: python scripts/check_translations.py [--base origin/main] +Missing translations are allowed: Android falls back to values/strings.xml. +""" + +import argparse +from collections import Counter +from pathlib import Path +import re +import subprocess +import sys +import xml.etree.ElementTree as ET + +ROOT = Path(__file__).resolve().parents[1] +RES = "app/src/main/res" +# Catalog arguments use explicit positions or unnumbered %s/%d/%.2f. +# Do not treat prose such as "100% free" as a format argument. +FORMAT = re.compile(r"%%|(?