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
7 msgmerge: Fix behaviour of --for-msgfmt on PO files with no translations.
9 Reported by Don Lawrence <dlawrence@iecok.com>
10 in <https://lists.freedesktop.org/archives/p11-glue/2019-May/000700.html>
12 in <https://lists.gnu.org/archive/html/bug-gettext/2019-05/msg00124.html>.
14 * gettext-tools/src/msgmerge.c (main): Treat force_po like true if for_msgfmt
16 * gettext-tools/tests/msgmerge-26: Add test of PO file with no translations.
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>
21 gettext-tools/src/msgmerge.c | 4 ++--
22 gettext-tools/tests/msgmerge-26 | 36 ++++++++++++++++++++++++++++++---
23 2 files changed, 35 insertions(+), 5 deletions(-)
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\
32 /* Write the merged message list out. */
33 - msgdomain_list_print (result, output_file, output_syntax, force_po,
35 + msgdomain_list_print (result, output_file, output_syntax,
36 + for_msgfmt || force_po, false);
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"
48 -${DIFF} mm-test26.ok mm-test26.out
50 +${DIFF} mm-test26.ok mm-test26.out || Exit 1
53 +# Test with a PO file that has no translated messages.
55 +cat <<\EOF > mm-test26a.in1
58 +"Content-Type: text/plain; charset=UTF-8\n"
64 +cat <<\EOF > mm-test26a.in2
67 +"Content-Type: text/plain; charset=ASCII\n"
69 +msgid "Hello, world!"
73 +: ${MSGMERGE=msgmerge}
74 +${MSGMERGE} --for-msgfmt -o mm-test26a.tmp mm-test26a.in1 mm-test26a.in2 \
76 +LC_ALL=C tr -d '\r' < mm-test26a.tmp > mm-test26a.out || Exit 1
78 +cat <<\EOF > mm-test26a.ok
80 +msgstr "Content-Type: text/plain; charset=UTF-8\n"
84 +${DIFF} mm-test26a.ok mm-test26a.out || Exit 1