diff options
Diffstat (limited to 'aux/workflow/l10n.sh')
-rwxr-xr-x | aux/workflow/l10n.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/aux/workflow/l10n.sh b/aux/workflow/l10n.sh new file mode 100755 index 0000000..81a7d02 --- /dev/null +++ b/aux/workflow/l10n.sh @@ -0,0 +1,44 @@ +#!/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 + +for f in $(find $@ -not -name '*.en.*'); do + case "$f" in + *.en.[1-9].in) + manpage "$f" + ;; + *) + echo "Unsupported file format: $f" >&2 + exit 2 + ;; + esac +done + +manpage() { + from_f="$1" + for l in $LANGS; do + to_f="$(echo "$from_f" | sed "s/\.en\./.$l./")" + po4a-updatepo -f man -m "$from_f" -p "po/$l.po" + OUT="$(po4a-translate -f man -m "$from_f" -p "po/$l.po" -l "$to_f" -k 0 -v 2>&1)" + echo "$OUT" >&2 + if ! echo "$OUT" | grep -qF ' is 100% translated ('; then + printf '\n\tWARNING!\n Missing translations for %s\n\n' "$to_f" >&2 + fi + done +} |