1 /* Test program, used by the format-c-5 test.
2 Copyright (C) 2004, 2006, 2010, 2015 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 /* For %Id to work, we need the real setlocale(), not the fake one. */
28 #if !(__GLIBC__ >= 2 && !defined __UCLIBC__)
29 # include "setlocale.c"
32 /* Make sure we use the included libintl, not the system's one. */
34 #include "libgnuintl.h"
36 #define _(string) gettext (string)
39 main (int argc, char *argv[])
44 const char *expected_translation;
45 const char *expected_result;
48 xsetenv ("LC_ALL", argv[1], 1);
49 if (setlocale (LC_ALL, "") == NULL)
50 /* Couldn't set locale. */
54 bindtextdomain ("fc5", ".");
56 s = gettext ("father of %d children");
57 en = "father of %d children";
58 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
59 expected_translation = "Vater von %Id Kindern";
60 expected_result = "Vater von \xdb\xb5 Kindern";
62 expected_translation = "Vater von %d Kindern";
63 expected_result = "Vater von 5 Kindern";
66 if (strcmp (s, en) == 0)
68 fprintf (stderr, "String untranslated.\n");
71 if (strcmp (s, expected_translation) != 0)
73 fprintf (stderr, "String incorrectly translated.\n");
77 if (strcmp (buf, expected_result) != 0)
79 fprintf (stderr, "printf of translation wrong.\n");