aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/l10n.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xaux/workflow/l10n.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/aux/workflow/l10n.sh b/aux/workflow/l10n.sh
new file mode 100755
index 0000000..e1fd3bb
--- /dev/null
+++ b/aux/workflow/l10n.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+set -eu
+
+LANGS=
+while getopts 'l:' flag; do
+ case "$flag" in
+ l)
+ LANGS="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+if [ -z "$LANGS" ]; then
+ echo "Missing LANG" >&2
+ exit 2
+fi
+
+end="\033[0m"
+yellow="\033[0;33m"
+manpage() {
+ from_f="$1"
+ for l in $LANGS; do
+ to_f="$(echo "$from_f" | sed "s/\.en\./.$l./")"
+
+ printf 'Generating %s...\n' "$to_f"
+ OUT="$(mktemp)"
+ po4a-updatepo -f man -m "$from_f" -p "doc/po/$l.po"
+ po4a-translate -f man -m "$from_f" -p "doc/po/$l.po" -l "$to_f" -k 0 -v 2>&1 | tee "$OUT" >&2
+
+ if ! grep -qF ' is 100% translated (' "$OUT"; then
+ printf "\n\t${yellow}WARNING${end}!\n Missing translations for %s\n\n" "$to_f" >&2
+ fi
+ done
+}
+
+for f in "$@"; do
+ case "$f" in
+ *.en.[1-9].in)
+ mkdir -p doc/po
+ manpage "$f"
+ ;;
+ *)
+ echo "Unsupported file format: $f" >&2
+ exit 2
+ ;;
+ esac
+done