summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-21 02:17:42 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-21 02:19:12 +0100
commit53f12424df7773d7118ab3fe54981670ba29e683 (patch)
treeef4ac1ed3e3f664ec745a7de39e2992ff6003bc6
parent792d198f3f694e5475d1467b5ae9371a23baf7a3 (diff)
download-translations: make sure all .po files are UTF-8
-rwxr-xr-xdownload-translations24
1 files changed, 22 insertions, 2 deletions
diff --git a/download-translations b/download-translations
index 21f2ac0..f210c94 100755
--- a/download-translations
+++ b/download-translations
@@ -64,15 +64,35 @@ do
PO_URL="$PACKAGE_PO_URL_BASE/$d.po"
PO_FILENAME="$PACKAGE.$d.po"
if wget -q -nc -O $PO_FILENAME $PO_URL; then
+ # we want all .po files in UTF-8 format really, so convert if needed..
+ CHARSET=`grep Content-Type $PO_FILENAME | sed -e 's/.*charset=\(.*\)\\\\n.*/\1/'`
+ if test "x$CHARSET" != "xUTF-8" -a "x$CHARSET" != "xutf-8"; then
+ # note: things like the bugs address will be added back by make update-po
+ if msguniq $PO_FILENAME --no-location \
+ --output-file=$PO_FILENAME.utf8 \
+ --to-code=UTF-8; then
+ mv $PO_FILENAME.utf8 $PO_FILENAME
+ else
+ echo "**** $d: conversion from $CHARSET to UTF-8 failed ****"
+ fi
+ fi
if [ -f "po/$d.po" ]; then
# ./po/foo.po exists, so let's check if ours matches the latest from the
# translation project website
- if diff $PO_FILENAME "po/$d.po" >/dev/null; then
+ REVDATE_NEW=`grep PO-Revision-Date $PO_FILENAME`;
+ REVDATE_OLD=`grep PO-Revision-Date po/$d.po`;
+ CHARSET_OLD=`grep Content-Type po/$d.po | sed -e 's/.*charset=\(.*\)\\\\n.*/\1/'`
+ if test "x$REVDATE_NEW" = "x$REVDATE_OLD" -a "x$CHARSET_OLD" = "xUTF-8"; then
+ # note: source code line markers will be removed later by make upload-po
echo "$d.po: up-to-date"
rm -f $PO_FILENAME
else
mv $PO_FILENAME "po/$d.po"
- echo "$d.po: updated"
+ if test "x$CHARSET_OLD" != "xUTF-8" -a "x$CHARSET_OLD" != "xutf-8"; then
+ echo "$d.po: update (and charset converted from $CHARSET_OLD to UTF-8)"
+ else
+ echo "$d.po: updated"
+ fi
DOMAINS_UPDATED="$DOMAINS_UPDATED $d"
fi
else