Code

Updated framework
[gosa.git] / gen_locale.sh
index 8b70dc40a4738e79cf477de8ac5361f255af005b..9f57ca906d49fb64815d59fdc2b9e633004de0bf 100755 (executable)
@@ -2,6 +2,7 @@
 
 ORIG=`pwd`
 TEMPDIR="/tmp/gosa-locale"
+TRUE=`which true`
 
 echo
 echo "Creating temporary directory..."
@@ -15,14 +16,14 @@ echo -n "Converting .tpl files: "
 pushd . &> /dev/null
 cd $TEMPDIR
 
-for template in $(find -name '*.tpl'); do
+for template in $(find -name '*.tpl'); do
   echo -en "\rConverting .tpl files: $(basename $template)                 \r"
   sed -e 's/{t}/<?php $t= _("/g;s!{/t}!");?>!g' $template > $template.new
   mv $template.new $template
 done
 
-for class in $(find -name 'class_*.inc'); do
-  echo -en "\rConverting .tpl files: $(basename $template)                 \r"
+for class in $(find -name 'class_*.inc'); do
+  echo -en "\rConverting class_*.inc files: $(basename $template)                 \r"
   sed -e 's/\($pl[DH][^=]*\)= *"\([^"]*\)";$/\1= _("\2");/g' $class > $class.new
   mv $class.new $class
 done
@@ -34,7 +35,7 @@ mv contrib/gosa.conf.new contrib/gosa.conf
 
 echo "Extracting languages..."
 rm locale/messages.po
-(echo contrib/gosa.conf; find . -name '*.[ctpi][ophn][nlpc]') | xgettext -f - --omit-header --keyword=must -d Domain -L PHP -n -o locale/messages.po
+(echo contrib/gosa.conf; find . -name '*.[ctpi][ophn][nlpc]') | xgettext -f - --keyword=must -d Domain -L PHP -n -o locale/messages.po
 
 echo "Merging po files with existing ones:"
 error=0
@@ -44,7 +45,7 @@ for f in locale/??/LC_MESSAGES; do
 
   # Do an extra check for dummy dir 'locale/en/LC_MESSAGES'
   if [ $? -ne 0 ]; then
-    [ "$f" == "locale/en/LC_MESSAGES" ] && /bin/true
+    [ "$f" == "locale/en/LC_MESSAGES" ] && $TRUE
   fi
 
   if [ $? -eq 0 ]; then
@@ -84,7 +85,7 @@ if [ $error -eq 0 ]; then
   read -p "Do you want to erase the message.po.orig files? (y/n)" -n1 ans
 
   if [ "$ans" == "y" -o "$ans" == "Y" ]; then
-    find $ORIG -type f -name 'messages.po.orig' -exec rm -f {} \;
+    find $ORIG/ -type f -name 'messages.po.orig' -exec rm -f {} \;
   fi
 
 else