summaryrefslogtreecommitdiffstats
path: root/po/check_for_tutorial_problems.sh
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2015-09-10 09:43:47 +0000
committerJazzyNico <nicoduf@yahoo.fr>2015-09-10 09:43:47 +0000
commit7f0069d359b3f41addc520a9687c1922c899e4b3 (patch)
tree2d78410a81c3d62ac2b4582e29e97d71aa5264c5 /po/check_for_tutorial_problems.sh
parentDocumentation. New German translation of the Keys and mouse reference. (diff)
downloadinkscape-7f0069d359b3f41addc520a9687c1922c899e4b3.tar.gz
inkscape-7f0069d359b3f41addc520a9687c1922c899e4b3.zip
Documentation. Updating the FAQ link in the Help>FAQ menu. Updating doc links (FAQ, K&M and man) in the PO files.
(bzr r14355)
Diffstat (limited to 'po/check_for_tutorial_problems.sh')
-rwxr-xr-xpo/check_for_tutorial_problems.sh67
1 files changed, 55 insertions, 12 deletions
diff --git a/po/check_for_tutorial_problems.sh b/po/check_for_tutorial_problems.sh
index ef967195c..f38442a3c 100755
--- a/po/check_for_tutorial_problems.sh
+++ b/po/check_for_tutorial_problems.sh
@@ -1,21 +1,64 @@
#!/bin/bash
# check the main Inkscape tree for tutorial-related problems
-# $1: full name of the root directory of the local copy of the main Inkscape tree
-# usage example:
-# check_for_tutorial_problems.sh /tmp/inkscape
+
+#
+# usage() : short help
+#
+usage() { cat <<EOF
+Usage :
+ $0 [--help] [--base-dir] languages
+EOF
+}
LANG=C
LC_ALL=C
+user_lang=
+base_dir="$(pwd)/.."
+
+# Command line options
+while test $# -gt 0
+do
+ case $1 in
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ -b | --base-dir)
+ shift
+ base_dir=$1
+ ;;
+ -*) echo "$0 : invalid option $1" >&2
+ usage
+ exit 1
+ ;;
+ *)
+ user_lang="$@"
+ break
+ ;;
+ esac
+ shift
+done
+echo $base_dir
+if [ ! -e "$base_dir/po" ]
+ then
+ echo "$base_dir is not a valid inkscape base"
+ exit 0
+fi
+
# First pass to detect invalid links to installed tutorials (trailing
# space, typo...).
echo "===== Checking tutorials links in PO files ======"
-PO_FILE_LIST=`ls -1 "$1/po/" | grep "\.po$" | sort`
+
+if [ "$user_lang" ]
+ then PO_FILE_LIST="$user_lang"
+ else PO_FILE_LIST=`ls -1 "$base_dir/po/" | grep "\.po$" | sort`
+fi
echo "$PO_FILE_LIST" |\
while read PO_FILENAME; do
echo "----- $PO_FILENAME -----------------------------------"
- TRANSLATIONS_IN_CURRENT_PO=`cat "$1/po/$PO_FILENAME" | grep -A 1 "^msgid\ \"tutorial-[^.]*\.svg\""`
+ TRANSLATIONS_IN_CURRENT_PO=`cat "$base_dir/po/$PO_FILENAME" | grep -A 1 "^msgid\ \"tutorial-[^.]*\.svg\""`
UNTRANSLATED_COUNT=`echo "$TRANSLATIONS_IN_CURRENT_PO" | grep -c "^msgstr \"\""`
if [ $UNTRANSLATED_COUNT -gt 0 ]; then
echo "$PO_FILENAME has $UNTRANSLATED_COUNT untranslated tutorial filenames"
@@ -25,7 +68,7 @@ while read PO_FILENAME; do
while read TUTORIAL_FILENAME_TRANSLATION_LINE; do
TUTORIAL_FILENAME_TRANSLATION=`echo "$TUTORIAL_FILENAME_TRANSLATION_LINE" |\
sed 's/^msgstr \"\(.*\)\"[ ]*$/\1/'`
- if [ ! -e "$1/share/tutorials/$TUTORIAL_FILENAME_TRANSLATION" ]; then
+ if [ ! -e "$base_dir/share/tutorials/$TUTORIAL_FILENAME_TRANSLATION" ]; then
echo -n "$PO_FILENAME references \"$TUTORIAL_FILENAME_TRANSLATION\""
echo " ERROR: THE REFERENCED FILE DOESN'T EXIST, PLEASE CHECK"
fi
@@ -37,13 +80,13 @@ done
# linked in the PO file.
echo
echo "===== Checking tutorials not referenced in PO files ======"
-TUTORIAL_FILE_LIST=`ls -1 "$1/share/tutorials/" | grep "^tutorial-[^.]*\...\.svg$" | sort`
+TUTORIAL_FILE_LIST=`ls -1 "$base_dir/share/tutorials/" | grep "^tutorial-[^.]*\...\.svg$" | sort`
echo "$TUTORIAL_FILE_LIST" |\
while read TUTORIAL_FILENAME; do
LANGUAGE_CODE=`echo "$TUTORIAL_FILENAME" | sed 's/^tutorial-[^.]*\.\(..\)\.svg$/\1/'`
- if [ -e "$1/po/$LANGUAGE_CODE.po" ]; then
- TRANSLATIONS_IN_CURRENT_PO=`cat "$1/po/$LANGUAGE_CODE.po" | grep -A 1 "^msgid\ \"tutorial-[^.]*\.svg\""`
+ if [ -e "$base_dir/po/$LANGUAGE_CODE.po" ]; then
+ TRANSLATIONS_IN_CURRENT_PO=`cat "$base_dir/po/$LANGUAGE_CODE.po" | grep -A 1 "^msgid\ \"tutorial-[^.]*\.svg\""`
echo "$TRANSLATIONS_IN_CURRENT_PO" | grep -q "^msgstr \"$TUTORIAL_FILENAME\""
if [ $? -ne 0 ]; then
echo "WARNING: $TUTORIAL_FILENAME IS NOT REFERENCED IN $LANGUAGE_CODE.po"
@@ -56,13 +99,13 @@ done
# Last pass to check if tutorials are correctly added in Makefile.am
echo
echo "===== Checking Makefile.am ======"
-TUTORIAL_DIRECTORY_FILELIST=`ls -1 "$1/share/tutorials/" | grep -v "^Makefile.am$" | sort`
+TUTORIAL_DIRECTORY_FILELIST=`ls -1 "$base_dir/share/tutorials/" | grep -v "^Makefile.am$" | sort`
echo "$TUTORIAL_DIRECTORY_FILELIST" |\
while read TUTORIAL_DIRECTORY_FILENAME; do
- cat "$1/share/tutorials/Makefile.am" | grep -q "^ $TUTORIAL_DIRECTORY_FILENAME "
+ cat "$base_dir/share/tutorials/Makefile.am" | grep -q "^ $TUTORIAL_DIRECTORY_FILENAME "
if [ $? -ne 0 ]; then
- cat "$1/share/tutorials/Makefile.am" | grep -q "^ $TUTORIAL_DIRECTORY_FILENAME$"
+ cat "$base_dir/share/tutorials/Makefile.am" | grep -q "^ $TUTORIAL_DIRECTORY_FILENAME$"
if [ $? -ne 0 ]; then
echo "WARNING: $TUTORIAL_DIRECTORY_FILENAME IS NOT IN Makefile.am"
fi