diff options
author | Frans Pop <elendil@planet.nl> | 2008-12-02 15:41:33 +0000 |
---|---|---|
committer | Frans Pop <elendil@planet.nl> | 2008-12-02 15:41:33 +0000 |
commit | 6c538fe6a652278f6d2d1ea57b3d6cbea7e5fff6 (patch) | |
tree | 83d1ce659ee84767f7efe00817778490b3882341 | |
parent | cecae8f3939aa56eeb6a430f69c973d4d834984e (diff) | |
download | installation-guide-6c538fe6a652278f6d2d1ea57b3d6cbea7e5fff6.zip |
Make script work for XML-based translations as well
-rwxr-xr-x | scripts/check-preseed | 39 | ||||
-rwxr-xr-x | scripts/po-check-preseed | 32 |
2 files changed, 39 insertions, 32 deletions
diff --git a/scripts/check-preseed b/scripts/check-preseed new file mode 100755 index 000000000..7c527bf83 --- /dev/null +++ b/scripts/check-preseed @@ -0,0 +1,39 @@ +#! /bin/sh + +lang="$1" + +if [ -z "$lang" ] || ([ ! -d po/"$lang" ] && [ ! -d "./$lang" ]); then + echo "Usage: $(basename $0) <language>" + exit 1 +fi + +echo "This script performs a very basic sanity check to see if nothing has" +echo "been missed in the translation of preseed.po. It does this by counting" +echo "the number of lines that start with 'd-i' or '#d-i' for both msgid and" +echo "msgstr and printing the result. It will then print a diff between the" +echo "original and translation for a visual check." +echo +echo + +tmp_orig=$(mktemp -p /tmp preseed_orig.XXXXXX) +tmp_trans=$(mktemp -p /tmp preseed_trans.XXXXXX) + +if [ -d "po/$lang" ]; then + cd $po + + sed -n "/^msgid/,/^msgstr/ p" preseed.po | grep -v msgstr | \ + grep "^\"#\?d-i " >$tmp_orig + sed -n "/^msgstr/,/^$/ p" preseed.po | \ + grep "^\"#\?d-i " >$tmp_trans +else + grep "^#\?d-i " en/appendix/preseed.xml >$tmp_orig + grep "^#\?d-i " $lang/appendix/preseed.xml >$tmp_trans +fi + +echo "Number of original lines: $(wc -l <$tmp_orig)" +echo "Number of translated lines: $(wc -l <$tmp_trans)" +echo + +diff -U0 $tmp_orig $tmp_trans + +rm -f $tmp_orig $tmp_trans diff --git a/scripts/po-check-preseed b/scripts/po-check-preseed deleted file mode 100755 index b5523bfbe..000000000 --- a/scripts/po-check-preseed +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh - -if [ -z "$1" ] || [ ! -d po/"$1" ]; then - echo "Usage: $(basename $0) <language>" - exit 1 -fi - -cd po/$1 - -echo "This script performs a very basic sanity check to see if nothing has" -echo "been missed in the translation of preseed.po. It does this by counting" -echo "the number of lines that start with 'd-i' or '#d-i' for both msgid and" -echo "msgstr and printing the result. It will then print a diff between the" -echo "original and translation for a visual check." -echo -echo - -tmp_msgid=$(mktemp -p /tmp preseed_msgid.XXXXXX) -tmp_msgstr=$(mktemp -p /tmp preseed_msgstr.XXXXXX) - -sed -n "/^msgid/,/^msgstr/ p" preseed.po | grep -v msgstr | \ - grep "^\"#\?d-i " >$tmp_msgid -sed -n "/^msgstr/,/^$/ p" preseed.po | \ - grep "^\"#\?d-i " >$tmp_msgstr - -echo "Number of original lines: $(wc -l <$tmp_msgid)" -echo "Number of translated lines: $(wc -l <$tmp_msgstr)" -echo - -diff -U0 $tmp_msgid $tmp_msgstr - -rm -f $tmp_msgid $tmp_msgstr |