public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
cmsmadesimple-2-0 / admin / lang / addline.sh
100755 30 lines (24 sloc) 0.678 kb
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
#!/bin/sh
 
#Shell script to add a new line to each existing translation file
#
#Example: addline.sh 'messagename' 'new message text'
 
if [ $# -ne 2 ] ; then
  echo "usage: addline.sh 'messagename' 'new message text'"
  exit 1
fi
 
#First check en_US to make sure it doesn't exist
grep "lang\['admin'\]\['$1'\]" en_US/admin.inc.php > /dev/null
if [ $? -eq 0 ] ; then
  echo "lang['admin']['$1'] already exists"
  exit 1
fi
 
for file in `find . -name "admin.inc.php"`
do
  echo $file " "
  grep -v '?>' ${file} > ${file}.new
  echo "\$lang['admin']['"$1"'] = '"$2"'; //needs translation" >> ${file}.new
  echo "?>" >> ${file}.new
  rm $file
  mv ${file}.new $file
done
 
echo "Message Added"