Add message.po scripts for addons

This commit is contained in:
Philipp Holzer 2021-05-22 13:53:49 +02:00
parent b1cc9b3463
commit 27fe9fe7db
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
3 changed files with 32 additions and 0 deletions

View file

@ -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

17
transifex/check-addons.sh Executable file
View file

@ -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

13
transifex/xgettext-addon.sh Executable file
View file

@ -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