• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test that gettext() returns the message converted to the locale's encoding.
5
6test -d in-2-1 || mkdir in-2-1
7test -d in-2-1/fr || mkdir in-2-1/fr
8test -d in-2-1/fr/LC_MESSAGES || mkdir in-2-1/fr/LC_MESSAGES
9
10: ${MSGFMT=msgfmt}
11${MSGFMT} -o in-2-1/fr/LC_MESSAGES/tstprog.mo "$wabs_srcdir"/intl-2-1.po
12
13test -d in-2-2 || mkdir in-2-2
14test -d in-2-2/fr || mkdir in-2-2/fr
15test -d in-2-2/fr/LC_MESSAGES || mkdir in-2-2/fr/LC_MESSAGES
16
17: ${MSGFMT=msgfmt}
18${MSGFMT} -o in-2-2/fr/LC_MESSAGES/tstprog.mo "$wabs_srcdir"/intl-2-2.po
19
20: ${DIFF=diff}
21cat <<EOF > in-2-1.ok
22K�se
23EOF
24cat <<EOF > in-2-2.ok
25Käse
26EOF
27
28: ${LOCALE_FR=fr_FR}
29: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
30if test $LOCALE_FR != none; then
31  prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR
32  prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR
33  ../intl-1-prg in-2-1 $LOCALE_FR > in-2.tmp || Exit 1
34  LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1
35  ${DIFF} in-2-1.ok in-2.out || Exit 1
36  ../intl-1-prg in-2-2 $LOCALE_FR > in-2.tmp || Exit 1
37  LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1
38  ${DIFF} in-2-1.ok in-2.out || Exit 1
39fi
40if test $LOCALE_FR_UTF8 != none; then
41  prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR_UTF8
42  prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR_UTF8
43  ../intl-1-prg in-2-1 $LOCALE_FR_UTF8 > in-2.tmp || Exit 1
44  LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1
45  ${DIFF} in-2-2.ok in-2.out || Exit 1
46  ../intl-1-prg in-2-2 $LOCALE_FR_UTF8 > in-2.tmp || Exit 1
47  LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1
48  ${DIFF} in-2-2.ok in-2.out || Exit 1
49fi
50if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
51  if test -f /usr/bin/localedef; then
52    echo "Skipping test: no french locale is installed"
53  else
54    echo "Skipping test: no french locale is supported"
55  fi
56  Exit 77
57fi
58
59Exit 0
60