1 /* Test program, used by the format-c-5 test.
2 Copyright (C) 2004 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 2, or (at your option)
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, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 /* For %Id to work, we need the real setlocale(), not the fake one. */
30 # include "setlocale.c"
33 /* Make sure we use the included libintl, not the system's one. */
35 #include "libgnuintl.h"
37 #define _(string) gettext (string)
40 main (int argc
, char *argv
[])
45 const char *expected_translation
;
46 const char *expected_result
;
49 xsetenv ("LC_ALL", argv
[1], 1);
50 if (setlocale (LC_ALL
, "") == NULL
)
52 fprintf (stderr
, "Couldn't set locale.\n");
57 bindtextdomain ("fc5", ".");
59 s
= gettext ("father of %d children");
60 en
= "father of %d children";
61 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
62 expected_translation
= "Vater von %Id Kindern";
63 expected_result
= "Vater von \xdb\xb5 Kindern";
65 expected_translation
= "Vater von %d Kindern";
66 expected_result
= "Vater von 5 Kindern";
69 if (strcmp (s
, en
) == 0)
71 fprintf (stderr
, "String untranslated.\n");
74 if (strcmp (s
, expected_translation
) != 0)
76 fprintf (stderr
, "String incorrectly translated.\n");
80 if (strcmp (buf
, expected_result
) != 0)
82 fprintf (stderr
, "printf of translation wrong.\n");