From 27fe9fe7dbf0c590b416c41f7acea68835c0fc74 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 22 May 2021 13:53:49 +0200 Subject: [PATCH] Add message.po scripts for addons --- transifex/Dockerfile | 2 ++ transifex/check-addons.sh | 17 +++++++++++++++++ transifex/xgettext-addon.sh | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100755 transifex/check-addons.sh create mode 100755 transifex/xgettext-addon.sh diff --git a/transifex/Dockerfile b/transifex/Dockerfile index 00eacf0..2aa5b12 100644 --- a/transifex/Dockerfile +++ b/transifex/Dockerfile @@ -8,3 +8,5 @@ RUN apt-get update -q && \ && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* COPY check-messages.sh /check-messages.sh +COPY check-addons.sh /check-addons.sh +COPY xgettext-addon.sh /xgettext-addon.sh \ No newline at end of file diff --git a/transifex/check-addons.sh b/transifex/check-addons.sh new file mode 100755 index 0000000..9a023b0 --- /dev/null +++ b/transifex/check-addons.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Checks the addons messages.po files +# +DIR=${FRIENDICA_DIR:-$PWD} +ADDON_DIR=${FRIENDICA_ADDON_DIR:-"$DIR/addon"} + +cd $ADDON_DIR + +# Skip first 4 lines in possible diff, because they're header +# Skip all lines of the git diff starting with "@@" or comments or starting "POT-Creation-Date" +if [[ $(git diff -U0 **/messages.po | grep -vE '^(@@|\-"POT-Creation-Date|\+"POT-Creation-Date|\-#|\+#)' | wc -l) -gt 4 ]]; then + echo "$(git diff **/messages.po)" + exit 1 +else + echo "Nothing to update" +fi diff --git a/transifex/xgettext-addon.sh b/transifex/xgettext-addon.sh new file mode 100755 index 0000000..039f756 --- /dev/null +++ b/transifex/xgettext-addon.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Checks the addons messages.po files +# +DIR=${FRIENDICA_DIR:-$PWD} +ADDON_DIR=${FRIENDICA_ADDON_DIR:-"$DIR/addon"} + +cd $ADDON_DIR +changed_files=($(git diff --name-status ${DRONE_COMMIT_BEFORE}..${DRONE_COMMIT_AFTER} | cut -f2 | sed '/^\./d' | cut -d "/" -f1 | uniq)) +cd $DIR +for addon in "${changed_files[@]}"; do + ./bin/run_xgettext.sh --addon $addon; +done