lazarus/tools/convert_po_file_to_utf-8.sh
mattias a51bbbe67a converted iso translations to utf-8
git-svn-id: trunk@10428 -
2007-01-11 21:54:44 +00:00

24 lines
519 B
Bash
Executable File

#!/usr/bin/env bash
#
# Author: Mattias Gaertner
#
# converts a .po files to UTF-8
set -e
#set -x
POFile=$1
if [ -f "$POFile" ]; then
OldCharSet=$(cat $POFile | egrep '^".* charset=' | sed -e 's/.*charset=\(.*\)"/\1/' -e 's/\\n//')
echo $OldCharSet
if [ -n "$OldCharSet"="UTF-8" ]; then
iconv --from-code=$OldCharSet --to-code=UTF-8 $POFile > $POFile.tmp
cat $POFile.tmp | sed -e 's/\(^".* charset\)='$OldCharSet'/\1=UTF-8/' > $POFile
rm $POFile.tmp
fi
else
echo Usage: $0 po-file
exit -1
fi