aboutsummaryrefslogtreecommitdiff
path: root/src/examples/msgs_i18n.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/msgs_i18n.c')
-rw-r--r--src/examples/msgs_i18n.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c
index 2d8eb566..e5f92bb5 100644
--- a/src/examples/msgs_i18n.c
+++ b/src/examples/msgs_i18n.c
@@ -45,29 +45,29 @@
45 45
46static int 46static int
47ahc_echo (void *cls, 47ahc_echo (void *cls,
48 struct MHD_Connection *cnc, 48 struct MHD_Connection *cnc,
49 const char *url, 49 const char *url,
50 const char *mt, 50 const char *mt,
51 const char *ver, 51 const char *ver,
52 const char *upd, 52 const char *upd,
53 size_t *upsz, 53 size_t *upsz,
54 void **ptr) 54 void **ptr)
55{ 55{
56 return MHD_NO; 56 return MHD_NO;
57} 57}
58 58
59 59
60static void 60static void
61error_handler (void *cls, 61error_handler (void *cls,
62 const char *fm, 62 const char *fm,
63 va_list ap) 63 va_list ap)
64{ 64{
65 /* Here we do the translation using GNU gettext. 65 /* Here we do the translation using GNU gettext.
66 As the error message is from libmicrohttpd, we specify 66 As the error message is from libmicrohttpd, we specify
67 "libmicrohttpd" as the translation domain here. */ 67 "libmicrohttpd" as the translation domain here. */
68 vprintf (dgettext ("libmicrohttpd", 68 vprintf (dgettext ("libmicrohttpd",
69 fm), 69 fm),
70 ap); 70 ap);
71} 71}
72 72
73 73
@@ -75,21 +75,22 @@ int
75main (int argc, 75main (int argc,
76 char **argv) 76 char **argv)
77{ 77{
78 setlocale(LC_ALL, ""); 78 setlocale (LC_ALL, "");
79 79
80 /* The example uses PO files in the directory 80 /* The example uses PO files in the directory
81 "libmicrohttpd/src/examples/locale". This 81 "libmicrohttpd/src/examples/locale". This
82 needs to be adapted to match 82 needs to be adapted to match
83 where the MHD PO files are installed. */ 83 where the MHD PO files are installed. */
84 bindtextdomain ("libmicrohttpd", 84 bindtextdomain ("libmicrohttpd",
85 "locale"); 85 "locale");
86 MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_FEATURE_MESSAGES | MHD_USE_ERROR_LOG, 86 MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_FEATURE_MESSAGES
87 8080, 87 | MHD_USE_ERROR_LOG,
88 NULL, NULL, 88 8080,
89 &ahc_echo, NULL, 89 NULL, NULL,
90 MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL, 90 &ahc_echo, NULL,
91 99999 /* invalid option, to raise the error 91 MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL,
92 "Invalid option ..." which we are going 92 99999 /* invalid option, to raise the error
93 to translate */); 93 "Invalid option ..." which we are going
94 to translate */);
94 return 1; /* This program won't "succeed"... */ 95 return 1; /* This program won't "succeed"... */
95} 96}