Adding count of untranslated strings.
authorchals <chals@altorricon.com>
Tue, 19 Nov 2013 18:48:02 +0000 (19:48 +0100)
committerchals <chals@altorricon.com>
Tue, 19 Nov 2013 18:48:02 +0000 (19:48 +0100)
Makefile
manual/bin/count-untranslated-strings.sh [new file with mode: 0755]

index 17c8a36..a75b1ef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -96,8 +96,8 @@ commit: tidy test
                echo "There are $(shell grep -w 'fuzzy' manual/po/*/* | wc -l) fuzzy strings. You can run 'make fixfuzzy' to fix them." ; \
        fi
        @echo
-       @echo "In order to find untranslated strings type 'make translate'."
-
+       @echo "There are $(shell manual/bin/count-untranslated-strings.sh) untranslated strings. You can run 'make translate' to find them." ; \
+       
        @echo
        @echo "You may now proceed...please do:"
        @echo
diff --git a/manual/bin/count-untranslated-strings.sh b/manual/bin/count-untranslated-strings.sh
new file mode 100755 (executable)
index 0000000..3f579f9
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+# Count total number of untranslated strings in live-manual
+
+Count_untranslated_strings ()
+{
+for POFILE in manual/po/*/*
+       do
+               if [ "$(sed '$!d' ${POFILE})" = 'msgstr ""' ]
+                       then
+                               sed '$G' ${POFILE} | grep --extended-regexp --before-context=1 '^$' | grep --count '^msgstr ""$' || continue            
+               else
+                               grep --extended-regexp --before-context=1 '^$' ${POFILE} | grep --count '^msgstr ""$' || continue
+               fi
+       done
+}
+
+
+Count_untranslated_strings | awk '{ sum += $1 } END { print sum }'
\ No newline at end of file