summaryrefslogtreecommitdiff
path: root/addLanguage.sh
authorcniehaus <cniehaus>2002-06-16 15:13:51 (UTC)
committer cniehaus <cniehaus>2002-06-16 15:13:51 (UTC)
commit0704b913f5da703218f66ddc18a4c6b280577d97 (patch) (side-by-side diff)
treea8edef8565de586043be70c2400a999cd9b74738 /addLanguage.sh
parent47f58b07e3718500193262bf4a0a2d13c9b7d539 (diff)
downloadopie-0704b913f5da703218f66ddc18a4c6b280577d97.zip
opie-0704b913f5da703218f66ddc18a4c6b280577d97.tar.gz
opie-0704b913f5da703218f66ddc18a4c6b280577d97.tar.bz2
This adds the nice script provided by bruno. Thanks
Diffstat (limited to 'addLanguage.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-xaddLanguage.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/addLanguage.sh b/addLanguage.sh
new file mode 100755
index 0000000..7d8a296
--- a/dev/null
+++ b/addLanguage.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# (c) 2002 Bruno Rodrigues <bruno.rodrigues@litux.org>
+# Under GPL Licence
+
+# Add a new TRANSLATION line to every .pro file if there
+# is already at least one TRANSLATION file and this LANG
+# is not present
+# The perl line would grab a TRANSLATION = something and
+# duplicate it to TRANSLATION += .../LANG/...
+
+LANG=$1
+
+if [ "$1x" == "x" ] ; then
+ echo "Usage: $0 <LANG>"
+ exit
+fi
+
+for i in `find . -name "*.pro"` ; do
+ grep TRANSLATIONS $i > /dev/null
+ if [ "$?" != 0 ] ; then
+ echo "$i: No Translations"
+ else
+ grep "../i18n/$LANG/" $i > /dev/null
+ if [ "$?" == 0 ] ; then
+ echo "$i: $LANG already there"
+ else
+ echo "$i: Adding $LANG"
+ perl -p -i.bak -e 's/^(TRANSLATIONS\s+)(([^+])?=)(.+?i18n\/)(.+?)(\/.+?)$/$1$2$4$5$6\n$1+=$4'$LANG'$6/' $i
+ fi
+ fi
+done
+
+
+