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 / scripts / langXref.sh
100755 32 lines (27 sloc) 0.859 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
31
32
#!/bin/sh
# a boring little script to cross reference a .module.php file with a lang file
# to find out which lang['entries'] are missing and are extra.
# usage: langXref.sh lang_file php_file ...
 
 
_lang=$1
shift
_lang_entries=`grep -e '^\\$lang' $_lang | cut -d\' -f2 | cut -d\" -f2 | sort | uniq`
_code_entries=`cat $* | grep Lang | cut -d\' -f2 | cut -d\" -f2 | sort | uniq`
 
# find all the entries in code but not in lang file
echo "Missing entries in lang file"
echo "----------------------------"
for c in $_code_entries ; do
_x=`echo $_lang_entries | grep -c $c`
  if [ $_x = 0 ]; then
echo $c
  fi
done
 
# find all the entries in lang file but not in code
echo
echo "Extra entries in lang file"
echo "--------------------------"
for l in $_lang_entries ; do
_x=`echo $_code_entries | grep -c $l`
  if [ $_x = 0 ]; then
echo $l
  fi
done