aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsilvioprog <silvioprog@gmail.com>2017-02-28 22:36:40 -0300
committersilvioprog <silvioprog@gmail.com>2017-02-28 22:36:40 -0300
commitbf56a65a0cda87d8edc8e8926c8ee5e49b0121df (patch)
treeb1437e9499909384aea21632cda221aae4c42b04
parent347cbe5f10709c146cc6fce06acb082de01f2995 (diff)
downloadlibmicrohttpd-bf56a65a0cda87d8edc8e8926c8ee5e49b0121df.tar.gz
libmicrohttpd-bf56a65a0cda87d8edc8e8926c8ee5e49b0121df.zip
i18n example has been failed in some SOs, then we decided to make it as an extra dist
-rw-r--r--src/examples/Makefile.am8
-rwxr-xr-xsrc/examples/msgs_i18n.c17
2 files changed, 4 insertions, 21 deletions
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 0e211678..ba8e4307 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -25,12 +25,13 @@ noinst_PROGRAMS = \
25 minimal_example_comet \ 25 minimal_example_comet \
26 querystring_example \ 26 querystring_example \
27 timeout \ 27 timeout \
28 msgs_i18n \
29 fileserver_example \ 28 fileserver_example \
30 fileserver_example_dirs \ 29 fileserver_example_dirs \
31 fileserver_example_external_select \ 30 fileserver_example_external_select \
32 refuse_post_example 31 refuse_post_example
33 32
33EXTRA_DIST = msgs_i18n.c
34noinst_EXTRA_DIST = msgs_i18n.c
34 35
35if ENABLE_HTTPS 36if ENABLE_HTTPS
36noinst_PROGRAMS += https_fileserver_example 37noinst_PROGRAMS += https_fileserver_example
@@ -74,11 +75,6 @@ timeout_SOURCES = \
74timeout_LDADD = \ 75timeout_LDADD = \
75 $(top_builddir)/src/microhttpd/libmicrohttpd.la 76 $(top_builddir)/src/microhttpd/libmicrohttpd.la
76 77
77msgs_i18n_SOURCEs = \
78 msgs_i18n.c
79msgs_i18n_LDADD = \
80 $(top_builddir)/src/microhttpd/libmicrohttpd.la
81
82chunked_example_SOURCES = \ 78chunked_example_SOURCES = \
83 chunked_example.c 79 chunked_example.c
84chunked_example_LDADD = \ 80chunked_example_LDADD = \
diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c
index ed23d982..398a86da 100755
--- a/src/examples/msgs_i18n.c
+++ b/src/examples/msgs_i18n.c
@@ -23,27 +23,14 @@
23 */ 23 */
24 24
25/* 25/*
26 * suposing you are in the libmicrohttp root directory and the LANG is `pt_BR`: * 26 * suposing you are in Brazil:
27 * 27 *
28 * # generate the POT file
29 * $ xgettext --keyword=_ --language=C --add-comments --sort-output -o libmicrohttpd.pot src/microhttpd/*.c
30 *
31 * # generate the PO file
32 * $ msginit --input=libmicrohttpd.pot --locale=pt_BR --output=libmicrohttpd.po
33 *
34 * # open the generated .po in any program like Poedit and translate the MHD messages; once done, let's go to the test:
35 * mkdir -p src/examples/locale/pt_BR/LC_MESSAGES
36 * mv libmicrohttpd.mo libmicrohttpd.po src/examples/locale/pt_BR/LC_MESSAGES
37 * cd src/examples/
38 * gcc -o msgs_i18n msgs_i18n.c -lmicrohttpd
39 * export LANGUAGE=pt_BR 28 * export LANGUAGE=pt_BR
40 * ./msgs_i18n 29 * ./msgs_i18n
41 * # it may print: Opção inválida 4196490! (Você terminou a lista com MHD_OPTION_END?) 30 * # it may print: Opção inválida 4196490! (Você terminou a lista com MHD_OPTION_END?)
42 * 31 *
43 * # tip: if you get any problem in your i18n application, you can debug it using `strace` tool, e.g: 32 * # tip: if you get any problem in your i18n application, you can debug it using `strace` tool, e.g:
44 * $ strace -e trace=open ./msgs_i18n 33 * $ strace -e trace=open ./msgs_i18n
45 *
46 * That's all!
47 * 34 *
48 */ 35 */
49 36
@@ -86,6 +73,6 @@ main() {
86 NULL, NULL, 73 NULL, NULL,
87 &ahc_echo, NULL, 74 &ahc_echo, NULL,
88 MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL 75 MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL
89 /* MHD_OPTION_END - to raise the error "Invalid option ..." we are going to translate */); 76 /* MHD_OPTION_END - to raise the error "Invalid option ..." we are going to translate */);
90 return 1; /* purposely */ 77 return 1; /* purposely */
91} 78}