name: Check translations build

on:
  pull_request:
    branches: [ "master", "release-*"]
    paths:
      - 'po/xournalpp.pot'
      - 'po/*.po'

jobs:
  check-translations:
    if: startsWith(github.head_ref, 'l10n-')
    name: Check translations
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v6
      - name: 'Install dependencies'
        shell: bash
        run: |
          sudo apt-get update
          sudo apt-get install -y gettext
          # Download the last .its/loc files for gettext - Cheaper than installing all of gtk + dependencies
          sudo wget https://raw.githubusercontent.com/GNOME/gtk/gtk-3-24/gtk/gtkbuilder.{its,loc} -P /usr/share/gettext/its/
      - name: 'Check translations build'
        shell: bash
        run: |
          mkdir build
          cd build
          cmake .. -DONLY_CONFIGURE_FOR_TARGET_POT=on
          cmake --build . --target translations
