From 2251f73e1696714c5462fa4be882bbbf212a7095 Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 21 Jan 2008 15:04:43 +0000 Subject: [PATCH] Updated update-gosa and locale git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8524 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/update-gosa | 2 +- gosa-core/update-locale | 33 ++++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/gosa-core/update-gosa b/gosa-core/update-gosa index a50368d37..89b83232d 100755 --- a/gosa-core/update-gosa +++ b/gosa-core/update-gosa @@ -1,7 +1,7 @@ #!/usr/bin/php5 /dev/null + [ -f $f/messages.po ] && msgmerge $f/messages.po locale/${l_path}messages.po --output-file=$f/messages.po.new &> /dev/null # Do an extra check for dummy dir 'locale/en/LC_MESSAGES' if [ $? -ne 0 ]; then - [ "$f" == "locale/en/LC_MESSAGES" ] && $TRUE + [ "$f" == "locale/${l_path}en/LC_MESSAGES" ] && $TRUE fi if [ $? -eq 0 ]; then @@ -55,13 +55,13 @@ generate_po() { done echo "Copying new po files, making backups..." - find . -name messages.po | while read f; do + find locale/${l_path} -name messages.po | while read f; do if [ -f $ORIG/$f ]; then mv $ORIG/$f $ORIG/$f.orig fi - echo $f | grep -q "locale/messages.po" + echo $f | grep -q "locale/${l_path}messages.po" if [ $? -ne 0 ]; then echo "* replaced $ORIG/$f" cp $f.new $ORIG/$f @@ -114,7 +114,6 @@ EOF # MAIN # GENERATE=0 -COMPILE=0 ASSUME_Y=0 while getopts ":gyh" opt do @@ -124,7 +123,8 @@ do y) ASSUME_Y=1; ;; h|--help) - echo "Usage: $(basename $0) [-g] [-y]" + echo "Usage: $(basename $0) [-g] [-y] method" + echo " method can be 'core' or 'plugin'" echo " -g extract strings from GOsa and generate po files" echo " -y assume yes" exit 1 @@ -133,8 +133,19 @@ do done shift $(($OPTIND - 1)) +# Check method +if [ "$1" != "plugin" -a "$1" != "core" ]; then + echo "Need explicit method 'core' or 'plugin' to create locale." + exit 1 +fi +if [ "$1" == "plugin" ]; then + l_path="" +else + l_path="core/" +fi + # Default to generate -if [ $GENERATE -eq 0 -a $COMPILE -eq 0 ]; then +if [ $GENERATE -eq 0 ]; then GENERATE=1 fi -- 2.30.2