name: Translations

# Fast, SDK-free parity check for translation resources, so Weblate PRs (which
# only touch values-*/strings.xml) get quick feedback without the full Android
# build. The deeper checks still run in CI via lintDebug (ExtraTranslation).
on:
  pull_request:
    paths:
      - 'app/src/main/res/values*/strings.xml'
      - 'app/src/main/res/xml/locales_config.xml'
      - 'scripts/check_translations.py'
      - '.gitea/workflows/translations.yaml'

concurrency:
  group: translations-${{ github.ref }}
  cancel-in-progress: true

jobs:
  check:
    runs-on: docker
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Ensure python3
        run: |
          if ! command -v python3 >/dev/null 2>&1; then
            if command -v apt-get >/dev/null 2>&1; then
              apt-get update && apt-get install -y python3
            elif command -v apk >/dev/null 2>&1; then
              apk add --no-cache python3
            fi
          fi
          python3 --version

      - name: Check translation parity
        run: python3 scripts/check_translations.py
