diff --git a/tools/check-translation-status.sh b/tools/check-translation-status.sh index 269e3961a6..9b802b23e4 100755 --- a/tools/check-translation-status.sh +++ b/tools/check-translation-status.sh @@ -54,6 +54,10 @@ fi A=$(echo "$FILE" | sed -E "s/\.[a-z][a-z]\.$EXT//") # get change date of English file EN=$A.en.$EXT +if [ ! -e "$EN" ]; then + out "English file does not exist. Aborting. ($EN)" + exit 2 +fi endate=$(git log --pretty="%cd" --date=raw -1 "$EN"|cut -d' ' -f1) # Convert to YYYY-MM-DD ymd=$(date +"%Y-%m-%d" --date="@$endate") diff --git a/tools/encoding-convert.sh b/tools/encoding-convert.sh index 6ed2e12be3..9ed0e7d18d 100755 --- a/tools/encoding-convert.sh +++ b/tools/encoding-convert.sh @@ -1,15 +1,29 @@ #!/bin/bash +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# Select files #FILES=$(git grep -i -l "<\?xml.*encoding=\"iso" .) FILES=$(find . -type f) while read -r file; do enc=$(file --mime-encoding ${file} | cut -d" " -f2) + # Only run if not correct encoding, and if XML, XHTML, or XSL file if [ "${enc}" != "utf-8" ] && [ "${enc}" != "us-ascii" ] && [ $(echo $file | grep -qoE "(\.xml$|\.xhtml$|\.xsl$)"; echo $?) -eq 0 ]; then - iconv -f ${enc} -t UTF-8 ${file} -o ${file}.utf8 - sed -Ei "s@(@I" ${file}.utf8 + # Move edited file to original location + mv ${file}.utf8 ${file} + # Status report + enc_new=$(file --mime-encoding ${file} | cut -d" " -f2) + echo "Converted $file from $enc to $enc_new" + elif [ $trstatus = 1 ]; then + echo "WARNING: $file is outdated" + fi fi done <<< "${FILES}"