summaryrefslogtreecommitdiff
path: root/scripts/addLanguage.sh
Unidiff
Diffstat (limited to 'scripts/addLanguage.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/addLanguage.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/addLanguage.sh b/scripts/addLanguage.sh
new file mode 100755
index 0000000..e321804
--- a/dev/null
+++ b/scripts/addLanguage.sh
@@ -0,0 +1,33 @@
1#!/bin/bash
2
3# (c) 2002 Bruno Rodrigues <bruno.rodrigues@litux.org>
4# Under GPL Licence
5
6# Add a new TRANSLATION line to every .pro file if there
7# is already at least one TRANSLATION file and this LANG
8# is not present
9# The perl line would grab a TRANSLATION = something and
10# duplicate it to TRANSLATION += .../LANG/...
11
12LANG=$1
13
14if [ "$1x" == "x" ] ; then
15 echo "Usage: $0 <LANG>"
16 exit
17fi
18
19for i in `find . -name "*.pro"` ; do
20 grep TRANSLATIONS $i > /dev/null
21 if [ "$?" != 0 ] ; then
22 echo "$i: No Translations"
23 else
24 grep "../i18n/$LANG/" $i > /dev/null
25 if [ "$?" == 0 ] ; then
26 echo "$i: $LANG already there"
27 else
28 echo "$i: Adding $LANG"
29 perl -p -i.bak -e 's/^(TRANSLATIONS\s*\+?=\s*)(.+?i18n\/)(.+?)(\/.+?\.ts)(.*)$/$1$2$3$4 \\\n\t $2'$LANG'$4$5/' $i
30 fi
31 fi
32done
33