summaryrefslogtreecommitdiff
path: root/addLanguage.sh
blob: 7d8a2964e7c60c8fa19739830f1a711f5665dd91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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