1/* Test program, used by the gettext-3 test. 2 Copyright (C) 2000, 2005 Free Software Foundation, Inc. 3 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. 8 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. 13 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/>. */ 16 17/* Contributed to the GNU C Library by 18 Thorsten Kukuk <kukuk@suse.de> and Andreas Jaeger <aj@suse.de>, 2000. */ 19 20#ifdef HAVE_CONFIG_H 21# include <config.h> 22#endif 23 24#include <locale.h> 25#include <stdlib.h> 26#include <stdio.h> 27#include "setenv.h" 28 29/* Make sure we use the included libintl, not the system's one. */ 30#undef _LIBINTL_H 31#include "libgnuintl.h" 32 33#define N_(string) string 34 35struct data_t 36{ 37 const char *selection; 38 const char *description; 39}; 40 41struct data_t strings[] = 42{ 43 { "String1", N_("First string for testing.") }, 44 { "String2", N_("Another string for testing.") } 45}; 46const int data_cnt = sizeof (strings) / sizeof (strings[0]); 47 48const char *lang[] = { "de_DE", "fr_FR", "ll_CC" }; 49const int lang_cnt = sizeof (lang) / sizeof (lang[0]); 50 51int 52main (void) 53{ 54 int i; 55 56 /* Clean up environment. */ 57 unsetenv ("LANGUAGE"); 58 unsetenv ("LC_ALL"); 59 unsetenv ("LC_MESSAGES"); 60 unsetenv ("LC_CTYPE"); 61 unsetenv ("LANG"); 62 unsetenv ("OUTPUT_CHARSET"); 63 64 textdomain ("tstlang"); 65 66 for (i = 0; i < lang_cnt; ++i) 67 { 68 int j; 69 70 if (setlocale (LC_ALL, lang[i]) == NULL) 71 setlocale (LC_ALL, "C"); 72 73 bindtextdomain ("tstlang", "."); 74 75 for (j = 0; j < data_cnt; ++j) 76 printf ("%s - %s\n", strings[j].selection, 77 gettext (strings[j].description)); 78 } 79 80 return 0; 81} 82