]> code.ossystems Code Review - openembedded-core.git/blob
2245889386434e8baab0a5e1dd3b1fb5eef64ac1
[openembedded-core.git] /
1 From 75e315fdec82d1a17ebcd9e0712d109323578d68 Mon Sep 17 00:00:00 2001
2 From: Bruno Haible <bruno@clisp.org>
3 Date: Sun, 19 May 2019 11:10:06 +0200
4 Subject: [PATCH] msgmerge: Fix behaviour of --for-msgfmt on PO files with no
5  translations.
6
7 msgmerge: Fix behaviour of --for-msgfmt on PO files with no translations.
8
9 Reported by Don Lawrence <dlawrence@iecok.com>
10 in <https://lists.freedesktop.org/archives/p11-glue/2019-May/000700.html>
11 via Daiki Ueno
12 in <https://lists.gnu.org/archive/html/bug-gettext/2019-05/msg00124.html>.
13
14 * gettext-tools/src/msgmerge.c (main): Treat force_po like true if for_msgfmt
15 is true.
16 * gettext-tools/tests/msgmerge-26: Add test of PO file with no translations.
17
18 Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=2336451ed68d91ff4b5ae1acbc1eca30e47a86a9]
19 Signed-off-by: Khem Raj <raj.khem@gmail.com>
20 ---
21  gettext-tools/src/msgmerge.c    |  4 ++--
22  gettext-tools/tests/msgmerge-26 | 36 ++++++++++++++++++++++++++++++---
23  2 files changed, 35 insertions(+), 5 deletions(-)
24
25 diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c
26 index cd762c0..92c9b7a 100644
27 --- a/gettext-tools/src/msgmerge.c
28 +++ b/gettext-tools/src/msgmerge.c
29 @@ -520,8 +520,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\
30    else
31      {
32        /* Write the merged message list out.  */
33 -      msgdomain_list_print (result, output_file, output_syntax, force_po,
34 -                            false);
35 +      msgdomain_list_print (result, output_file, output_syntax,
36 +                            for_msgfmt || force_po, false);
37      }
38  
39    exit (EXIT_SUCCESS);
40 diff --git a/gettext-tools/tests/msgmerge-26 b/gettext-tools/tests/msgmerge-26
41 index cd3862e..b86f7a0 100755
42 --- a/gettext-tools/tests/msgmerge-26
43 +++ b/gettext-tools/tests/msgmerge-26
44 @@ -73,7 +73,37 @@ msgstr "Papaya"
45  EOF
46  
47  : ${DIFF=diff}
48 -${DIFF} mm-test26.ok mm-test26.out
49 -result=$?
50 +${DIFF} mm-test26.ok mm-test26.out || Exit 1
51  
52 -exit $result
53 +# Test with a PO file that has no translated messages.
54 +
55 +cat <<\EOF > mm-test26a.in1
56 +msgid ""
57 +msgstr ""
58 +"Content-Type: text/plain; charset=UTF-8\n"
59 +
60 +msgid "Hello world"
61 +msgstr "Hallo Welt"
62 +EOF
63 +
64 +cat <<\EOF > mm-test26a.in2
65 +msgid ""
66 +msgstr ""
67 +"Content-Type: text/plain; charset=ASCII\n"
68 +
69 +msgid "Hello, world!"
70 +msgstr ""
71 +EOF
72 +
73 +: ${MSGMERGE=msgmerge}
74 +${MSGMERGE} --for-msgfmt -o mm-test26a.tmp mm-test26a.in1 mm-test26a.in2 \
75 +    || Exit 1
76 +LC_ALL=C tr -d '\r' < mm-test26a.tmp > mm-test26a.out || Exit 1
77 +
78 +cat <<\EOF > mm-test26a.ok
79 +msgid ""
80 +msgstr "Content-Type: text/plain; charset=UTF-8\n"
81 +EOF
82 +
83 +: ${DIFF=diff}
84 +${DIFF} mm-test26a.ok mm-test26a.out || Exit 1
85 -- 
86 2.24.1
87