1 /* Test of the gettext functions.
2 Copyright (C) 2000-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Thorsten Kukuk <kukuk@suse.de> and
5 Andreas Jaeger <aj@suse.de>, 2000.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
27 #define N_(msgid) msgid
31 const char *selection
;
32 const char *description
;
36 struct data_t strings
[] =
38 { "String1", N_("First string for testing.") },
39 { "String2", N_("Another string for testing.") }
42 const int lang_cnt
= 3;
43 const char *lang
[] = {"lang1", "lang2", "lang3"};
50 /* Clean up environment. */
51 unsetenv ("LANGUAGE");
53 unsetenv ("LC_MESSAGES");
54 unsetenv ("LC_CTYPE");
56 unsetenv ("OUTPUT_CHARSET");
58 textdomain ("tstlang");
60 for (i
= 0; i
< lang_cnt
; ++i
)
64 if (setlocale (LC_ALL
, lang
[i
]) == NULL
)
65 setlocale (LC_ALL
, "C");
66 bindtextdomain ("tstlang", OBJPFX
"domaindir");
68 for (j
= 0; j
< data_cnt
; ++j
)
69 printf ("%s - %s\n", strings
[j
].selection
,
70 gettext (strings
[j
].description
));
76 #define TEST_FUNCTION do_test ()
77 #include "../test-skeleton.c"