From 53f12424df7773d7118ab3fe54981670ba29e683 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 21 Aug 2009 02:17:42 +0100 Subject: [PATCH] download-translations: make sure all .po files are UTF-8 --- download-translations | 24 ++++++++++++++++++++++-- 1 file 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 -- 2.7.4