• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test msgfmt and msgunfmt on a PO file with contexts.
5
6cat <<\EOF > mf-14.po
7msgid ""
8msgstr ""
9"Content-Type: text/plain; charset=UTF-8\n"
10"Content-Transfer-Encoding: 8bit\n"
11
12#. A menu item
13msgctxt "File|"
14msgid "Open"
15msgstr "Ouvrir"
16
17#. A menu item
18msgctxt "File|"
19msgid "New"
20msgstr "Nouveau"
21
22#. Denote a lock's state
23msgctxt "Lock state"
24msgid "Open"
25msgstr "Ouvert"
26
27#. Denote a lock's state
28msgctxt "Lock state"
29msgid "Closed"
30msgstr "Fermé"
31
32#. A product
33msgctxt "Audi"
34msgid "car"
35msgstr "voiture"
36
37#. A product
38msgctxt "Océ"
39msgid "copier"
40msgstr "photocopieur"
41
42#~ msgid "Save As"
43#~ msgstr "Enregistrer l'as"
44
45#. A menu item
46#~ msgctxt "File|"
47#~ msgid "Save As"
48#~ msgstr "Enregistrer sous"
49EOF
50
51: ${MSGFMT=msgfmt}
52${MSGFMT} -o mf-14.mo mf-14.po || Exit 1
53
54: ${MSGUNFMT=msgunfmt}
55${MSGUNFMT} -o mf-14.tmp mf-14.mo || Exit 1
56LC_ALL=C tr -d '\r' < mf-14.tmp > mf-14.out || Exit 1
57
58cat <<\EOF > mf-14.ok
59msgid ""
60msgstr ""
61"Content-Type: text/plain; charset=UTF-8\n"
62"Content-Transfer-Encoding: 8bit\n"
63
64msgctxt "Audi"
65msgid "car"
66msgstr "voiture"
67
68msgctxt "File|"
69msgid "New"
70msgstr "Nouveau"
71
72msgctxt "File|"
73msgid "Open"
74msgstr "Ouvrir"
75
76msgctxt "Lock state"
77msgid "Closed"
78msgstr "Fermé"
79
80msgctxt "Lock state"
81msgid "Open"
82msgstr "Ouvert"
83
84msgctxt "Océ"
85msgid "copier"
86msgstr "photocopieur"
87EOF
88
89: ${DIFF=diff}
90${DIFF} mf-14.ok mf-14.out
91result=$?
92
93exit $result
94