cp-po: Add additional PO file checks
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 9 May 2013 02:22:25 +0000 (22:22 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 9 May 2013 02:22:25 +0000 (22:22 -0400)
cp-po

diff --git a/cp-po b/cp-po
index 6f97dc4a1dd8bb59a768a2b70e583a64f3eb4b4a..ce7a12d003daa399ed5e669b299f492f3225ac0c 100755 (executable)
--- a/cp-po
+++ b/cp-po
@@ -121,6 +121,27 @@ for srcfile in $(find "$srcdir" -name '*.po'); do
                fi
        fi
 
+       if msgcat $srcfile 2>&1 >/dev/null | grep -q '.'; then
+               # checks for things like bogus escapes in msgid or msgstr
+               echo "$me: $srcfile has potential issues" 1>&2
+               msgcat $srcfile >/dev/null
+               if $force; then
+                       echo "$me: copying anyway, as requested" 1>&2
+               else
+                       continue
+               fi
+       fi
+
+       if grep -E -q '#~\|' $srcfile; then
+               echo "$me: $srcfile will fail with old gettext versions" 1>&2
+               grep -E -Hn '#~\|' $srcfile 1>&2 || :
+               if $force; then
+                       echo "$me: copying anyway, as requested" 1>&2
+               else
+                       continue
+               fi
+       fi
+
        for y in $nls_mks; do
                destcat=$(cat $y | sed -n 's/CATALOG_NAME.*:*= *\([^ ]*\)$/\1/p')
                if [ -z "$destcat" ]; then