[network-manager-openconnect] Add string importing script to git



commit 2e03be0a1db40e37b0bd762c38128c48050a50f3
Author: David Woodhouse <David Woodhouse intel com>
Date:   Wed Jun 20 14:35:37 2012 +0100

    Add string importing script to git

 import-strings.sh |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/import-strings.sh b/import-strings.sh
new file mode 100644
index 0000000..5c69661
--- /dev/null
+++ b/import-strings.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+if [ "$OPENCONNECT_DIR" = "" ]; then
+    OPENCONNECT_DIR=../openconnect
+fi
+
+# The openconnect.pot file is made available by a cron job on this server, along
+# with the project's web site which is also held in the git repository. There's
+# race condition here, if the server is updating as we run this script. But it's
+# unlikely that the string in question would move far, so it should be good enough.
+COMMIT="$(cd $OPENCONNECT_DIR && git rev-parse HEAD)"
+if ! echo $COMMIT | egrep -q "[a-f0-9]{40}"; then
+    echo "Error: Failed to fetch commit ID from $OPENCONNECT_DIR"
+    exit 1
+fi
+
+COMMIT=$(echo $COMMIT | cut -c1-10)
+COMMIT=b0f2edbae5
+GITWEB=http://git.infradead.org/users/dwmw2/openconnect.git/blob/${COMMIT}:/
+OUTFILE=openconnect-strings-$COMMIT.txt
+
+GITWEB=http://git.infradead.org/users/dwmw2/openconnect.git/blob/${COMMIT}:/
+
+cat >$OUTFILE <<EOF
+This file contains strings from the OpenConnect VPN client, found at
+http://www.infradead.org/openconnect/ and browseable in gitweb at
+http://git.infradead.org/users/dwmw2/openconnect.git
+
+We do this because NetworkManager-openconnect authentication dialog
+uses a lot of strings from libopenconnect, which also need to be
+translated too if the user is to have a fully localised experience.
+
+For translators looking to see source comments in their original context
+in order to translate them properly, the URLs by each one will give a
+link to the original source code.
+EOF
+
+#curl http://www.infradead.org/openconnect.git/po/openconnect.pot |
+cat /home/dwmw2/git/openconnect/gtls/po/openconnect.pot |
+while read -r a b; do
+    case "$a" in
+	"#:")
+	    echo >>$OUTFILE
+	    for src in $b; do
+		echo "// ${GITWEB}${src%%:*}#l${src##*:}" >>$OUTFILE
+	    done
+	    real_strings=yes
+	    ;;
+	"msgid")
+	    if [ "$real_strings" = "yes" ]; then
+		echo -n "_($b" >>$OUTFILE
+		in_msgid=yes
+	    fi
+	    ;;
+	"msgstr"|"")
+	    if [ "$in_msgid" = "yes" ]; then
+		in_msgid=no
+		echo ");" >>$OUTFILE
+	    fi
+	    ;;
+	*)
+	    if [ "$in_msgid" = "yes" ]; then
+		echo >>$OUTFILE
+		echo -n "$a $b" >>$OUTFILE
+	    fi
+	    ;;
+   esac
+done
+
+MESSAGES=$(grep -c "^_(" openconnect-strings-$COMMIT.txt)
+
+echo "Got $MESSAGES messages from openconnect upstream"
+
+if [ "$MESSAGES" -lt 100 ]; then
+    echo "Fewer than 100 messages? Something went wrong"
+    rm openconnect-strings-$COMMIT.txt
+    exit 1
+fi
+
+mv openconnect-strings-$COMMIT.txt openconnect-strings.txt
+
+set -x
+make -C po NetworkManager-openconnect.pot || exit 1
+for a in po/*.po ; do
+    if [ -r $OPENCONNECT_DIR/$a ]; then
+	msgmerge $a -C $OPENCONNECT_DIR/$a po/NetworkManager-openconnect.pot > $a.new && mv $a.new $a
+    fi
+done
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]