Skip to content

Commit cf8f5f8

Browse files
committed
Added translation check action
1 parent f554556 commit cf8f5f8

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

.github/workflows/pr.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,21 @@ jobs:
354354
- name: Reverse patch
355355
run: |
356356
docker compose exec phpfpm patch --strip=1 --verbose --input=${{ matrix.patch }} --reverse
357+
358+
check-translations:
359+
runs-on: ubuntu-latest
360+
steps:
361+
- uses: actions/checkout@v4
362+
- uses: arduino/setup-task@v2
363+
364+
- name: Install site
365+
run: |
366+
docker network create frontend
367+
task site-install --yes
368+
369+
- name: Extract translations
370+
run: |
371+
task translations:extract
372+
373+
- run: |
374+
task translations:diff

Taskfile.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ tasks:
8181

8282
site-open:
8383
cmds:
84-
- if command -v open 2>&1 >/dev/null; then open "$(task site-url)"; else echo "$(task site-url)"; fi
84+
- if command -v open 2>&1 >/dev/null; then open "$(task site-url)" || true; else echo "$(task site-url)"; fi
8585
silent: true
8686

8787
site-open-admin:
8888
cmds:
89-
- if command -v open 2>&1 >/dev/null; then open "{{.URL}}"; else echo "{{.URL}}"; fi
89+
- if command -v open 2>&1 >/dev/null; then open "{{.URL}}" || true; else echo "{{.URL}}"; fi
9090
vars:
9191
URL:
9292
sh: task drush -- user:login --no-browser
@@ -354,14 +354,26 @@ tasks:
354354
ref: .CUSTOM_THEMES
355355
LANGUAGE:
356356
- da
357+
# `drush potx` always writes to web/general.pot, so we move this file
358+
# into the desired destination in the `translations` folder inside the
359+
# module folder.
357360
cmd: |
358361
task drush -- potx single --folder=themes/custom/{{.ITEM.THEME}}/ --language {{.ITEM.LANGUAGE}} --translations && \
359362
mkdir -p web/themes/custom/{{.ITEM.THEME}}/translations && \
360363
mv web/general.pot web/themes/custom/{{.ITEM.THEME}}/translations/{{.ITEM.THEME}}.{{.ITEM.LANGUAGE}}.po
361364
internal: true
362365

366+
translations:diff:
367+
cmds:
368+
# Ignore some PO metadata when git diff'ing, e.g.
369+
#
370+
# "POT-Creation-Date: 2025-03-12 18:18+0100\n"
371+
# "PO-Revision-Date: 2025-03-12 18:18+0100\n"
372+
- git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' web/*/custom/*/translations
373+
363374
translations:extract:
364375
cmds:
376+
- task drush -- --yes pm:install potx
365377
- task: translations:extract:modules
366378
- task: translations:extract:themes
367379
silent: true

web/modules/custom/hoeringsportal_citizen_proposal/src/EventSubscriber/CitizenAccessCheckEventSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function accessCheck(AccessCheckEvent $event) {
5151
$cpr = $token[$cprClaim] ?? NULL;
5252

5353
if (empty($cpr)) {
54-
$this->logger->error(sprintf('Cannot get CPR (%s) from user claims', $cprClaim));
54+
$this->logger->error('Cannot get CPR (@cprClaim) from user claims', ['@cprClaim' => $cprClaim]);
5555
return;
5656
}
5757

web/modules/custom/hoeringsportal_citizen_proposal/translations/hoeringsportal_citizen_proposal.da.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ msgstr ""
9292
msgid "Citizen access denied"
9393
msgstr ""
9494

95+
#: modules/custom/hoeringsportal_citizen_proposal/src/EventSubscriber/CitizenAccessCheckEventSubscriber.php:54
96+
msgid "Cannot get CPR (@cprClaim) from user claims"
97+
msgstr ""
98+
9599
#: modules/custom/hoeringsportal_citizen_proposal/src/EventSubscriber/CitizenAccessCheckEventSubscriber.php:65
96100
msgid "Citizen access check exception: @message"
97101
msgstr ""

0 commit comments

Comments
 (0)