From 4aee271d034f5f0a47863594f07ef4d172ecc4f4 Mon Sep 17 00:00:00 2001 From: Oneric Date: Fri, 17 Jul 2020 18:29:16 +0200 Subject: [PATCH] po/make_pot: Fix sorting and make POSIX compliant Replaces non POSIX `echo -e` with an equivalent printf call and fixes sorting of lua files. This still leaves a problem with the order of old commented strings being being reversed and there #, c-format comments being stripped. See: https://savannah.gnu.org/bugs/?58778 --- po/make_pot.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/po/make_pot.sh b/po/make_pot.sh index 08d4feb16..75027f3d7 100755 --- a/po/make_pot.sh +++ b/po/make_pot.sh @@ -1,5 +1,8 @@ #!/bin/sh +#Abort on error +set -e + maybe_append() { while read -r msg; do msgfile=$(echo $msg | cut -d'|' -f1) @@ -7,13 +10,16 @@ maybe_append() { msgid=$(echo $msg | cut -d'|' -f3-) if ! grep -Fq "msgid $msgid" aegisub.pot; then - echo -e "\n#: $msgfile:$msgline\nmsgid $msgid\nmsgstr \"\"\n" >> aegisub.pot + printf "\n#: %s:%s\nmsgid %s\nmsgstr \"\"\n\n" \ + "$msgfile" "$msgline" "$msgid" >> aegisub.pot fi done } -find ../src -name \*.cpp -o -name \*.h | LC_ALL=C sort \ - | xgettext --files-from=- -o - --c++ -k_ -kSTR_MENU -kSTR_DISP -kSTR_HELP -kfmt_tl -kfmt_plural:2,3 -kwxT -kwxPLURAL:1,2 \ +find ../src -name \*.cpp -o -name \*.h \ + | LC_ALL=C sort \ + | xgettext --files-from=- -o - --c++ \ + -k_ -kSTR_MENU -kSTR_DISP -kSTR_HELP -kfmt_tl -kfmt_plural:2,3 -kwxT -kwxPLURAL:1,2 \ | sed 's/SOME DESCRIPTIVE TITLE./Aegisub 3.3+/' \ | sed 's/YEAR/2005-2020/' \ | sed "s/THE PACKAGE'S COPYRIGHT HOLDER/Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et. al./" \ @@ -34,6 +40,7 @@ grep '"[A-Za-z ]\+" : {' -n ../src/libresrc/default_hotkey.json \ | maybe_append find ../automation -name '*.lua' \ + | LC_ALL=C sort \ | xargs grep 'tr"[^"]*"' -o -n \ | sed 's/\(.*\):\([0-9]\+\):tr\(".*"\)/\1|\2|\3/' \ | sed 's/\\/\\\\\\\\/g' \