diff options
Diffstat (limited to 'aux/workflow/l10n.sh')
-rwxr-xr-x | aux/workflow/l10n.sh | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/aux/workflow/l10n.sh b/aux/workflow/l10n.sh index 89f2a6e..0d435b1 100755 --- a/aux/workflow/l10n.sh +++ b/aux/workflow/l10n.sh @@ -1,8 +1,6 @@ #!/bin/sh set -eu -mkdir -p doc/po - LANGS= while getopts 'l:' flag; do case "$flag" in @@ -20,26 +18,21 @@ if [ -z "$LANGS" ]; then exit 2 fi -po() { - format="$1" - from_f="$2" - to_f="$3" - lang="$4" - po4a-updatepo -M UTF-8 -f "$format" -m "$from_f" -p "doc/po/$lang.po" -v --previous - po4a-translate -M UTF-8 -f "$format" -m "$from_f" -p "doc/po/$lang.po" -v -L UTF-8 -l "$to_f" -k 0 >&2 -} - for from_f in "$@"; do for lang in $LANGS; do to_f="$(echo "$from_f" | sed "s/\.en\./.$lang./")" printf 'Generating %s...\n' "$to_f" + pofile="po/$from_f/$lang.po" + mkdir -p "$(dirname "$pofile")" case "$from_f" in *.en.[1-9].in) - po man "$from_f" "$to_f" "$lang" + po4a-updatepo -f man -m "$from_f" -p "$pofile" + po4a-translate -f man -m "$from_f" -p "$pofile" -l "$to_f" -k 0 -v >&2 ;; - *.en.md|*.en.msg) - po text "$from_f" "$to_f" "$lang" + *.en.md) + md2po "$from_f" --include-code-blocks -m --po-filepath "$pofile" --quiet --save + po2md "$from_f" --pofiles "$pofile" --quiet --save "$to_f" ;; *) echo "Unsupported file format: $from_f" >&2 @@ -52,7 +45,10 @@ done end="\033[0m" yellowb="\033[1;33m" for lang in $LANGS; do - if LANG=POSIX msgfmt --statistics "doc/po/$lang.po" 2>&1 | grep translated; then - printf "\n\t${yellowb}WARNING${end}!\n Missing translations for %s\n\n" "doc/po/$lang.po" >&2 - fi + # shellcheck disable=2044 + for pofile in $(find po/ -type f -name "$lang.po"); do + if LANG=POSIX msgfmt --statistics "$pofile" 2>&1 | grep untranslated; then + printf "\n\t${yellowb}WARNING${end}!\n Missing translations for %s\n\n" "$pofile" >&2 + fi + done done |