diff --git a/compile.sh b/compile.sh index d900ec0..088a3f1 100755 --- a/compile.sh +++ b/compile.sh @@ -18,12 +18,12 @@ source variables if [ ! $MSGFMT ]; then - echo -e "\E[31mThis program needs the msgfmt utility."; tput sgr0 + echo -e $RED"This program needs the msgfmt utility."; tput sgr0 exit 1 fi for BRANCH in $TRUNK $BRANCHES; do - echo -e "Repository: \E[34m$BRANCH"; tput sgr0 + echo -e "Repository: $BLUE$BRANCH"; tput sgr0 DIR="$PREFIX-$BRANCH" if [ ! -e "$MDIR/$BRANCH" ]; then mkdir -p "$MDIR/$BRANCH" @@ -32,7 +32,6 @@ for BRANCH in $TRUNK $BRANCHES; do echo "Compiling $file"; $MSGFMT "$DIR/$file" -o "$MDIR/$BRANCH/`echo $file | sed "s/."$LCODE".po/.mo/"`" done - echo "" done -echo -ne "\E[32mFinished."; tput sgr0; echo " " +echo -ne $GREEN"Finished."; tput sgr0; echo " " diff --git a/pack.sh b/pack.sh index f499ec3..74bd2ec 100755 --- a/pack.sh +++ b/pack.sh @@ -18,24 +18,24 @@ source variables if [ ! $DIFF ]; then - echo -e "\E[31mThis program needs the diff utility."; tput sgr0 + echo -e $RED"This program needs the diff utility."; tput sgr0 exit 1 fi if [ ! $TAR ]; then - echo -e "\E[31mThis program needs the tar utility."; tput sgr0 + echo -e $RED"This program needs the tar utility."; tput sgr0 exit 1 fi if [ ! $BZIP2 ]; then - echo -e "\E[31mThis program needs the bzip2 utility."; tput sgr0 + echo -e $RED"This program needs the bzip2 utility."; tput sgr0 exit 1 fi counter=0 for BRANCH in $TRUNK $BRANCHES; do - echo -e "Branch: \E[34m$BRANCH"; tput sgr0 + echo -e "Branch: $BLUE$BRANCH"; tput sgr0 DIR="$PREFIX-$BRANCH" mkdir "$LCODE-temp" for file in `ls $DIR/wesnoth*.$LCODE.po`; do @@ -46,15 +46,15 @@ for BRANCH in $TRUNK $BRANCHES; do if ! $DIFF -q "$file" "$BRANCH/$d/$LCODE.po" > /dev/null ; then mkdir "$LCODE-temp/$d" cp "$file" "$LCODE-temp/$d/$LCODE.po" - echo -e "\E[32mOK"; tput sgr0 + echo -e $GREEN"OK"; tput sgr0 counter=$(($counter+1)) else - echo -e "\E[34mSkipping"; tput sgr0 + echo -e $BLUE"Skipping"; tput sgr0 fi else mkdir -p "$LCODE-temp/$d" cp "$file" "$LCODE-temp/$d/$LCODE.po" - echo -e "\E[32mOK"; tput sgr0 + echo -e $GREEN"OK"; tput sgr0 counter=$(($counter+1)) fi done @@ -73,4 +73,4 @@ for BRANCH in $TRUNK $BRANCHES; do fi done -echo -ne "\E[32mFinished."; tput sgr0; echo " " +echo -ne $GREEN"Finished."; tput sgr0; echo " " diff --git a/statistics.sh b/statistics.sh index 4370474..ce951e9 100755 --- a/statistics.sh +++ b/statistics.sh @@ -24,17 +24,17 @@ CL=0 # counter for css style STATUS="OK" # Total status of translations if [ ! $MSGFMT ]; then - echo -e "\E[31mThis program needs the msgfmt utility."; tput sgr0 + echo -e $RED"This program needs the msgfmt utility."; tput sgr0 exit 1 fi if [ ! $ISUTF8 ]; then - echo -e "\E[31mThis program needs the isutf8 utility."; tput sgr0 + echo -e $RED"This program needs the isutf8 utility."; tput sgr0 exit 1 fi for BRANCH in $TRUNK $BRANCHES; do - echo -e "Repository: \E[34m$BRANCH"; tput sgr0 + echo -e "Repository: $BLUE$BRANCH"; tput sgr0 DIR="$PREFIX-$BRANCH" STATSFILE="statistics-$BRANCH.xhtml" ERRORS="translation-errors-$BRANCH" @@ -475,28 +475,28 @@ html>body #footer { if $ISUTF8 <$file >/dev/null 2>&1; then if ! echo $charset | grep -qi "UTF-8"; then has_errors="yes" - echo -e "\E[31mFAILED; non UTF-8 charset declaration for UTF-8 content"; tput sgr0 + echo -e $RED"FAILED; non UTF-8 charset declaration for UTF-8 content"; tput sgr0 echo "$file: non UTF-8 charset declared for UTF-8 content; expect to see 'charset=UTF-8'." >> $ERRORS else - echo -e "\E[32mOK"; tput sgr0 + echo -e $GREEN"OK"; tput sgr0 fi else if echo $charset | grep -qi "UTF-8"; then has_errors="yes" - echo -e "\E[31mFAILED; non UTF-8 content for UTF-8 charset declaration"; tput sgr0 + echo -e $RED"FAILED; non UTF-8 content for UTF-8 charset declaration"; tput sgr0 echo "$file: UTF-8 charset declared for non UTF-8 content; expect to see a non UTF-8 charset." >> $ERRORS else - echo -e "\E[32mOK"; tput sgr0 + echo -e $GREEN"OK"; tput sgr0 fi fi echo -n "Checking $file for odd characters... " if grep -nH $ODD_CHARS $file >> $ERRORS; then has_warnings="yes" - echo -e "\E[31mFAILED; odd characters found"; tput sgr0 + echo -e $RED"FAILED; odd characters found"; tput sgr0 echo "$file: one or more odd character from the '$ODD_CHARS' set found." >> $ERRORS else - echo -e "\E[32mOK"; tput sgr0 + echo -e $GREEN"OK"; tput sgr0 fi # Makes sense only if the file passed the UTF-8 check. @@ -504,9 +504,9 @@ html>body #footer { echo -n "Checking $file with msgfmt... " if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null $file >> $ERRORS; then has_errors="yes" - echo -e "\E[31mFAILED"; tput sgr0 + echo -e $RED"FAILED"; tput sgr0 else - echo -e "\E[32mOK"; tput sgr0 + echo -e $GREEN"OK"; tput sgr0 fi fi r=0; rf=0; ru=0; t=0; u=0; f=0; rt=0 @@ -570,21 +570,21 @@ html>body #footer { done if [ "$npo" -eq 0 ]; then - echo -e "\E[31mNo '${PO}.po' file under '$DIR'."; tput sgr0 + echo -e $RED"No '${PO}.po' file under '$DIR'."; tput sgr0 exit 0 fi if [ "$nerror" -gt 0 ]; then - echo -n -e "\E[31mFatal errors found. See '" + echo -n -e $RED"Fatal errors found. See '" tput smso; echo -n "$ERRORS"; tput rmso echo -ne "' for details."; tput sgr0 echo "" else - echo -ne "\E[32mNo fatal errors found."; tput sgr0 + echo -ne $GREEN"No fatal errors found."; tput sgr0 echo "" if [ -s "$ERRORS" ]; then - echo -n -e "\E[31m See '" + echo -n -e $RED" See '" tput smso; echo -n "$ERRORS"; tput rmso echo -ne "' for warnings."; tput sgr0 echo "" @@ -594,7 +594,7 @@ html>body #footer { fi if [ "$npo" = "$nerror" ]; then - echo -en "\E[31mAll files have fatal errors."; tput sgr0 + echo -en $RED"All files have fatal errors."; tput sgr0 echo "" else sum=$((${nt} + ${nf} + ${nu})) diff --git a/update.sh b/update.sh index 00db3e3..d714338 100755 --- a/update.sh +++ b/update.sh @@ -18,27 +18,27 @@ source variables if [ ! $SVN ]; then - echo -e "\E[31mThis program needs the svn utility."; tput sgr0 + echo -e $RED"This program needs the svn utility."; tput sgr0 exit 1 fi if [ ! $MSGFMT ]; then - echo -e "\E[31mThis program needs the msgfmt utility."; tput sgr0 + echo -e $RED"This program needs the msgfmt utility."; tput sgr0 exit 1 fi if [ ! $MSGMERGE ]; then - echo -e "\E[31mThis program needs the msgmerge utility."; tput sgr0 + echo -e $RED"This program needs the msgmerge utility."; tput sgr0 exit 1 fi if [ ! $MSGINIT ]; then - echo -e "\E[31mThis program needs the msginit utility."; tput sgr0 + echo -e $RED"This program needs the msginit utility."; tput sgr0 exit 1 fi if [ $GIT -eq 1 ] && [ ! $GITSVN ]; then - echo -e "\E[31mgit-svn is unavailable. svn will be used."; tput sgr0 + echo -e $RED"git-svn is unavailable. svn will be used."; tput sgr0 GIT=0 fi @@ -46,12 +46,12 @@ if [ $GIT -eq 1 ] && [ $GITSVN ]; then SVN="$GITSVN clone" fi -echo -e "Language: \E[31m$LCODE"; tput sgr0 +echo -e "Language: $RED$LCODE"; tput sgr0 echo "" if [ ! -z $TRUNK ]; then if [ -e $TRUNK/.git ] || [ -e $TRUNK/.svn ]; then - echo -e "Updating repository: \E[34mtrunk" + echo -e "Updating repository: "$BLUE"trunk" cd $TRUNK if [ $GIT -eq 1 ]; then $GITSVN rebase @@ -60,7 +60,7 @@ if [ ! -z $TRUNK ]; then fi cd .. else - echo -e "Downloading repository: \E[34mtrunk" + echo -e "Downloading repository: "$BLUE"trunk" if [ $GIT -eq 1 ]; then SVN="$GITSVN clone" else @@ -76,7 +76,7 @@ fi for BRANCH in $BRANCHES; do if [ -e $BRANCH/.git ] || [ -e $BRANCH/.svn ]; then - echo -e "Updating repository: \E[34m$BRANCH" + echo -e "Updating repository: $BLUE$BRANCH" cd $BRANCH if [ $GIT -eq 1 ]; then $GITSVN rebase @@ -85,7 +85,7 @@ for BRANCH in $BRANCHES; do fi cd .. else - echo -e "Downloading repository: \E[34m$BRANCH" + echo -e "Downloading repository: $BLUE$BRANCH" if [ $GIT -eq 1 ]; then SVN="$GITSVN clone" else @@ -102,7 +102,7 @@ done for BRANCH in $TRUNK $BRANCHES; do SVNDIR=$BRANCH DIR="$PREFIX-$BRANCH" - echo -e "Merging: \E[34m$BRANCH"; tput sgr0 + echo -e "Merging: $BLUE$BRANCH"; tput sgr0 for dir in `ls $SVNDIR/wesnoth* -d`; do echo "Processing "`basename $dir`"."$LCODE".po" stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null $dir"/"$LCODE".po" 2>&1` @@ -111,31 +111,31 @@ for BRANCH in $TRUNK $BRANCHES; do file=$DIR"/"`basename $dir`"."$LCODE".po" if [ -f $dir"/"$LCODE".po" ]; then if [ $(($u+$f)) == 0 ]; then - echo -e "\E[32mFile is translated."; tput sgr0 + echo -e $GREEN"File is translated."; tput sgr0 if [ -f $DIR"/"`basename $dir`"."$LCODE".po" ]; then - echo -e "\E[32mRemoving from $DIR."; tput sgr0 + echo -e $GREEN"Removing from $DIR."; tput sgr0 rm -f $file fi else if [ -f "$DIR/"`basename $dir`".$LCODE.po" ]; then - echo -e "\E[34mMerging:"; tput sgr0 + echo -e $BLUE"Merging:"; tput sgr0 $MSGMERGE -U -v $file $dir"/"`basename $dir`".pot" rm -f $file~ else - echo -e "\E[31mCopying:"; tput sgr0 + echo -e $RED"Copying:"; tput sgr0 cp $dir"/"$LCODE".po" $file fi fi else if [ ! -f $file ]; then - echo -e "\E[31mNo po file in repository. Running msginit."; tput sgr0 + echo -e $RED"No po file in repository. Running msginit."; tput sgr0 echo "$dir" $MSGINIT -i "$dir/`basename $dir`.pot" -o $file else - echo -e "\E[31mNo po file in repository. Found file in workspace."; tput sgr0 + echo -e $RED"No po file in repository. Found file in workspace."; tput sgr0 fi fi echo "" done done -echo -ne "\E[32mFinished."; tput sgr0; echo " " +echo -ne $GREEN"Finished."; tput sgr0; echo " " diff --git a/variables b/variables index dafa4d5..000908a 100644 --- a/variables +++ b/variables @@ -22,7 +22,7 @@ TRUNK="trunk" # "trunk" or "" # Options LCODE="lt" # Language code. Only 1 language is supported. -GIT=1 # Enable (1) or disable (0) git-svn. +GIT=0 # Enable (1) or disable (0) git-svn. #Paths MDIR="mo" @@ -38,3 +38,9 @@ TAR=`which tar 2> /dev/null` BZIP2=`which bzip2 2> /dev/null` DIFF=`which diff 2> /dev/null` GITSVN=`which git-svn 2> /dev/null` + +#Colors +RED="\033[0;31m" +GREEN="\033[1;32m" +BLUE="\033[1;34m" +ENDCOLOR="\033[0m" \ No newline at end of file