summaryrefslogtreecommitdiff
path: root/gettext-tools/tests/format-c-5
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/tests/format-c-5')
-rwxr-xr-xgettext-tools/tests/format-c-552
1 files changed, 52 insertions, 0 deletions
diff --git a/gettext-tools/tests/format-c-5 b/gettext-tools/tests/format-c-5
new file mode 100755
index 0000000..7868785
--- /dev/null
+++ b/gettext-tools/tests/format-c-5
@@ -0,0 +1,52 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test 'I' format directive flag.
+
+: ${XGETTEXT=xgettext}
+${XGETTEXT} -o fc5.tmp --omit-header --no-location "$abs_srcdir"/format-c-5-prg.c || exit 1
+LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot || exit 1
+
+cat <<EOF > fc5.ok
+#, c-format
+msgid "father of %d children"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} fc5.ok fc5.pot || exit 1
+
+# This should better be Farsi, not German. Can some translator help me?
+cat <<EOF > fa.po
+#, c-format
+msgid "father of %d children"
+msgstr "Vater von %Id Kindern"
+EOF
+
+test -d fa || mkdir fa
+test -d fa/LC_MESSAGES || mkdir fa/LC_MESSAGES
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} -o fa/LC_MESSAGES/fc5.mo fa.po
+
+: ${MSGUNFMT=msgunfmt}
+${MSGUNFMT} -o fa.po.tmp fa/LC_MESSAGES/fc5.mo || exit 1
+LC_ALL=C tr -d '\r' < fa.po.tmp > fa.po.un || exit 1
+
+: ${DIFF=diff}
+${DIFF} fa.po fa.po.un || exit 1
+
+LANGUAGE= ../fc5 fa_IR
+case $? in
+ 0) ;;
+ 77)
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: locale fa_IR not installed"
+ else
+ echo "Skipping test: locale fa_IR not supported"
+ fi
+ exit 77;;
+ *) exit 1;;
+esac
+
+exit 0