msgconv-1   [plain text]


#! /bin/sh

# Test conversion from BIG5 to UTF-8.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles mco-test1.po"
cat <<\EOF > mco-test1.po
# Chinese translation for GNU gettext messages.
#
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=big5\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/msgcmp.c:155 src/msgmerge.c:273
msgid "exactly 2 input files required"
msgstr "此功能需要恰好指定兩個輸入檔"
EOF

tmpfiles="$tmpfiles mco-test1.out"
: ${MSGCONV=msgconv}
${MSGCONV} --to-code=UTF-8 mco-test1.po -o mco-test1.out
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles mco-test1.ok"
cat <<\EOF > mco-test1.ok
# Chinese translation for GNU gettext messages.
#
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/msgcmp.c:155 src/msgmerge.c:273
msgid "exactly 2 input files required"
msgstr "甇文賡閬啣末摰拙頛詨交"
EOF

: ${DIFF=diff}
# Redirect stdout, so as not to fill the user's screen with non-ASCII bytes.
${DIFF} mco-test1.ok mco-test1.out >/dev/null
result=$?

rm -fr $tmpfiles

exit $result