summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/format-c-5
blob: 919296758669d61debf0e49fb9d7a4588b1862b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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