mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-28 00:03:47 +02:00
24 lines
519 B
Bash
Executable File
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
|
|
|