summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorSimon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>2020-05-10 23:56:07 +0200
committerSimon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>2020-05-10 23:56:07 +0200
commit80b156a04f30be4b7447484e424772022d87ef3b (patch)
treea6e352a2c574a534da4866c0ffdd22154e8eff56 /helpers
parent5333681a97d5d23b47a383f346019648337d7ba2 (diff)
downloadxfce4-dev-tools-80b156a04f30be4b7447484e424772022d87ef3b.tar.gz
Add helper script to get all translation-updates
Diffstat (limited to 'helpers')
-rw-r--r--helpers/xfce-get-translations49
1 files changed, 49 insertions, 0 deletions
diff --git a/helpers/xfce-get-translations b/helpers/xfce-get-translations
new file mode 100644
index 0000000..1d1da8b
--- /dev/null
+++ b/helpers/xfce-get-translations
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# Just a small script to get all language updates to a repository since a
+# commit or tag.
+
+LAST_TAG=$(git describe --abbrev=0)
+STARTTAG="${1:-$LAST_TAG}"
+ENDTAG="${2:-HEAD}"
+SILENT="${3:-}"
+
+LINE_LENGTH=72
+INDENT=" "
+
+UPDATES=$(git log --pretty=format:'%s' "$STARTTAG".."$ENDTAG" -- po/*.po | awk '{print $4}' | sort -u)
+
+if [ "${ENDTAG}" == "HEAD" ]; then
+ ENDTAG_PRETTY="now"
+else
+ ENDTAG_PRETTY=${ENDTAG}
+fi
+NUM_LANGS=$(echo ${UPDATES}|wc -w)
+
+if [ "$NUM_LANGS" = "0" ]; then
+ exit 0
+fi
+
+printf '%s\n' '- Translation Updates:'
+
+LANGUAGES=$(
+for l in $UPDATES; do
+ echo "$(grep '^"Language-Team:' po/$l.po | grep -Po '(?<=: ).*' | grep -Po '^(.*)(?= \(http)')"
+done
+)
+
+SORTED=$(echo "$LANGUAGES" | sort)
+while read line; do
+ echo -n "$line, "
+done <<< "$SORTED" | fold -s -w $LINE_LENGTH - | sed -e "s/^[^ ]/${INDENT}&/g" | sed -e 's/[[:space:]]*$//'
+echo ""
+
+if [ "$SILENT" != "silent" ]; then
+ echo -n "From ${STARTTAG} until ${ENDTAG_PRETTY} ${NUM_LANGS} language"
+ if [ $NUM_LANGS -ne 1 ]; then
+ echo -n "s have "
+ else
+ echo -n " has "
+ fi
+ echo "been updated."
+fi