name: translations-check

on:
  pull_request:
  push:
    branches:
      - main
      - develop
      - refactor_i18n
  schedule:
    # Twice a week at 03:00 UTC to catch drift in long-lived branches
    - cron: '0 3 * * 1,4'

jobs:
  validate-translations:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
      - name: Verify translation parity
        run: python scripts/check_translations.py

      - name: Verify translation key usage
        run: python scripts/check_translation_usage.py --fail-on-unused

      - name: Ensure locales metadata is up to date
        run: |
          python scripts/generate_languages.py
          git diff --exit-code -- src/i18n/locales.json
