1*946379e7Schristos /* Test program, used by the gettext-3 test.
2*946379e7Schristos Copyright (C) 2000, 2005 Free Software Foundation, Inc.
3*946379e7Schristos
4*946379e7Schristos This program is free software; you can redistribute it and/or modify
5*946379e7Schristos it under the terms of the GNU General Public License as published by
6*946379e7Schristos the Free Software Foundation; either version 2, or (at your option)
7*946379e7Schristos any later version.
8*946379e7Schristos
9*946379e7Schristos This program is distributed in the hope that it will be useful,
10*946379e7Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of
11*946379e7Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12*946379e7Schristos GNU General Public License for more details.
13*946379e7Schristos
14*946379e7Schristos You should have received a copy of the GNU General Public License
15*946379e7Schristos along with this program; if not, write to the Free Software Foundation,
16*946379e7Schristos Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17*946379e7Schristos
18*946379e7Schristos /* Contributed to the GNU C Library by
19*946379e7Schristos Thorsten Kukuk <kukuk@suse.de> and Andreas Jaeger <aj@suse.de>, 2000. */
20*946379e7Schristos
21*946379e7Schristos #ifdef HAVE_CONFIG_H
22*946379e7Schristos # include <config.h>
23*946379e7Schristos #endif
24*946379e7Schristos
25*946379e7Schristos #include <locale.h>
26*946379e7Schristos #include <stdlib.h>
27*946379e7Schristos #include <stdio.h>
28*946379e7Schristos #include "setenv.h"
29*946379e7Schristos
30*946379e7Schristos /* Make sure we use the included libintl, not the system's one. */
31*946379e7Schristos #undef _LIBINTL_H
32*946379e7Schristos #include "libgnuintl.h"
33*946379e7Schristos
34*946379e7Schristos #define N_(string) string
35*946379e7Schristos
36*946379e7Schristos struct data_t
37*946379e7Schristos {
38*946379e7Schristos const char *selection;
39*946379e7Schristos const char *description;
40*946379e7Schristos };
41*946379e7Schristos
42*946379e7Schristos struct data_t strings[] =
43*946379e7Schristos {
44*946379e7Schristos { "String1", N_("First string for testing.") },
45*946379e7Schristos { "String2", N_("Another string for testing.") }
46*946379e7Schristos };
47*946379e7Schristos const int data_cnt = sizeof (strings) / sizeof (strings[0]);
48*946379e7Schristos
49*946379e7Schristos const char *lang[] = { "de_DE", "fr_FR", "ll_CC" };
50*946379e7Schristos const int lang_cnt = sizeof (lang) / sizeof (lang[0]);
51*946379e7Schristos
52*946379e7Schristos int
main(void)53*946379e7Schristos main (void)
54*946379e7Schristos {
55*946379e7Schristos int i;
56*946379e7Schristos
57*946379e7Schristos /* Clean up environment. */
58*946379e7Schristos unsetenv ("LANGUAGE");
59*946379e7Schristos unsetenv ("LC_ALL");
60*946379e7Schristos unsetenv ("LC_MESSAGES");
61*946379e7Schristos unsetenv ("LC_CTYPE");
62*946379e7Schristos unsetenv ("LANG");
63*946379e7Schristos unsetenv ("OUTPUT_CHARSET");
64*946379e7Schristos
65*946379e7Schristos textdomain ("tstlang");
66*946379e7Schristos
67*946379e7Schristos for (i = 0; i < lang_cnt; ++i)
68*946379e7Schristos {
69*946379e7Schristos int j;
70*946379e7Schristos
71*946379e7Schristos if (setlocale (LC_ALL, lang[i]) == NULL)
72*946379e7Schristos setlocale (LC_ALL, "C");
73*946379e7Schristos
74*946379e7Schristos bindtextdomain ("tstlang", ".");
75*946379e7Schristos
76*946379e7Schristos for (j = 0; j < data_cnt; ++j)
77*946379e7Schristos printf ("%s - %s\n", strings[j].selection,
78*946379e7Schristos gettext (strings[j].description));
79*946379e7Schristos }
80*946379e7Schristos
81*946379e7Schristos return 0;
82*946379e7Schristos }
83