diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f6f335c1..ddb6d21e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -155,6 +155,15 @@ yarn lint: - apk add --no-cache git - yarn lint +translations lint: + image: alpine + stage: prepare + before_script: + - apk add gettext + script: + - find resources/lang -type f -name '*.po' -exec sh -c 'msgfmt "${1%.*}.po" -o"${1%.*}.mo"' shell {} \; + - '[[ $(find resources/lang -type f -name "*.po" | wc -l) == $(find resources/lang -type f -name "*.mo" | wc -l) ]]' + # # Build # @@ -177,6 +186,7 @@ build-image: - composer validate - yarn check - yarn lint + - translations lint - generate-version dependencies: - generate-version diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 6e5a7f3b..49f8ed05 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -72,7 +72,7 @@ docker compose exec es_workspace yarn build docker compose exec -e THEMES=0,1 es_workspace yarn build # Update the translation files -docker compose exec es_workspace find /var/www/resources/lang -type f -name '*.po' -exec sh -c 'file="{}"; msgfmt "${file%.*}.po" -o "${file%.*}.mo"' \; +docker compose exec es_workspace find /var/www/resources/lang -type f -name '*.po' -exec sh -c 'msgfmt "${1%.*}.po" -o"${1%.*}.mo"' shell {} \; # Run the migrations docker compose exec es_workspace bin/migrate @@ -118,7 +118,7 @@ The following instructions explain how to get, build and run the latest Engelsys ``` * Generate translation files ```bash - find resources/lang/ -type f -name '*.po' -exec sh -c 'file="{}"; msgfmt "${file%.*}.po" -o "${file%.*}.mo"' \; + find resources/lang/ -type f -name '*.po' -exec sh -c 'msgfmt "${1%.*}.po" -o"${1%.*}.mo"' shell {} \; ``` ## Testing diff --git a/bin/pre-commit b/bin/pre-commit index 8049b2d1..252b9298 100755 --- a/bin/pre-commit +++ b/bin/pre-commit @@ -3,10 +3,24 @@ # immediate exit after an error set -e +testing() { + echo + echo "🔎 Checking ${1}" +} + +testing 'JS & CSS 🎨' yarn check yarn lint +testing 'PHP ⚙️' composer validate composer phpcs composer phpstan ./vendor/bin/phpunit + +testing 'translations 🗺️' +find resources/lang -type f -name '*.po' -exec sh -c 'msgfmt "${1%.*}.po" -o"${1%.*}.mo"' shell {} \; +[ "$(find resources/lang -type f -name '*.po' | wc -l)" -eq "$(find resources/lang -type f -name '*.mo' | wc -l)" ] +find resources/lang -type f -name '*.mo' -exec rm {} \; + +echo '✅ Done 🎉' diff --git a/docker/Dockerfile b/docker/Dockerfile index 097fa96e..8af6ae34 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,7 +8,7 @@ RUN composer --no-ansi dump-autoload --optimize FROM alpine AS translation RUN apk add gettext COPY resources/lang/ /data -RUN find /data -type f -name '*.po' -exec sh -c 'file="{}"; msgfmt "${file%.*}.po" -o "${file%.*}.mo"' \; +RUN find /data -type f -name '*.po' -exec sh -c 'msgfmt "${1%.*}.po" -o"${1%.*}.mo"' shell {} \; # Build the themes FROM node:20-alpine AS themes diff --git a/resources/lang/de_DE/additional.po b/resources/lang/de_DE/additional.po index 65472519..870ccf6b 100644 --- a/resources/lang/de_DE/additional.po +++ b/resources/lang/de_DE/additional.po @@ -52,9 +52,6 @@ msgstr "Bitte gib eine E-Mail-Adresse an." msgid "validation.email.email" msgstr "Die E-Mail-Adresse ist nicht gültig." -msgid "validation.password.length" -msgstr "Dein neues Passwort ist zu kurz." - msgid "validation.new_password.length" msgstr "Dein neues Passwort ist zu kurz." diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 8168951a..fd48cc5a 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -1095,18 +1095,12 @@ msgstr "Engel:" msgid "Date, Duration:" msgstr "Termin, Dauer:" -msgid "Location:" -msgstr "Ort:" - msgid "Title:" msgstr "Titel:" msgid "Type:" msgstr "Typ:" -msgid "Location" -msgstr "Ort" - msgid "created at %s by %s" msgstr "erstellt am %s von %s" @@ -1904,9 +1898,6 @@ msgid "angeltypes.hide_on_shift_view.info" msgstr "Wenn ausgewählt, können nur Admins und Mitglieder des Engeltyps auf der " "Schicht Seite die Filteroption für diesen Engeltyp sehen." -msgid "registration.register" -msgstr "Registrieren" - msgid "location.locations" msgstr "Orte" diff --git a/resources/lang/en_US/additional.po b/resources/lang/en_US/additional.po index a7625778..7bc4a8e2 100644 --- a/resources/lang/en_US/additional.po +++ b/resources/lang/en_US/additional.po @@ -50,9 +50,6 @@ msgstr "The e-mail address is required." msgid "validation.email.email" msgstr "This e-mail address is not valid." -msgid "validation.password.length" -msgstr "Your new password is too short." - msgid "validation.new_password.length" msgstr "Your new password is too short." diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index d2d4763d..17045da4 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -670,9 +670,6 @@ msgstr "Event data" msgid "registration.what_todo" msgstr "What do you want to do?" -msgid "registration.register" -msgstr "Register" - msgid "tshirt.required.hint" msgstr "Please specify a T-shirt size in your settings!"