# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-2.0-or-later
name: Check translations

on:
  pull_request:
    types: [opened, synchronize, reopened]

# Declare default permissions as read only.
permissions: read-all

jobs:
  checkGermanTranslations:
    runs-on: ubuntu-latest
    
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - name: Check German
        run: |
          [[ $(grep "Benötigt keine Übersetzung" translations/client_de.ts -c) -gt 0 ]] && exit 1 || exit 0

  checkTranslations:
    runs-on: ubuntu-latest
    container: ghcr.io/nextcloud/continuous-integration-translations-desktop:latest

    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - name: Check Elipsis
        run: |
          lupdate -no-obsolete src/gui/ src/cmd/ src/common/ $crashreporter src/csync/ src/libsync/ $resources -ts ../ci-client.ts
          if [ $(grep '\.\.\.' ../ci-client.ts | wc -l) -ne 0 ]; then
            echo "English source contains three consecutive dots. Unicode … should be used instead"
            exit -1
          fi
