Imported Debian patch 2.23.05-1
[hcoop/zz_old/debian/webalizer.git] / debian / patches / 23_gettext_first_part.diff
CommitLineData
dc9c5d88
FAW
1From: Julien Viard de Galbert <julien@vdg.blogsite.org>
2Subject: Convert to use gettext [first part]
3
4If you apply this patch you MUST apply the next patch as this patch is not self
5contained. The reason is that the second patch can be regenerated by running a
6script.
7
8This patch is based on 17_gettext.dpatch by Jose Carlos Medeiros <debian@psabs.com.br>
9He described his patch as follows:
10#############################################
11# To create this patch I did follow:
12# 1. Created and ran script lang_po.sh , see it above below.
13# This script create a new .c file and a .diff file t each source .c file
14# 2. Changed these arrays strings from ex. l_month[] to _(l_month[])
15# l_month[], s_month[], h_msg[], language, response[], top_ctrys[]
16# 3. Changed "language" string to _("locale")
17# 4. After ran lang_po.sh script, it change another strings that cant be
18# translated. Then I need to change wrong substituitions like:
19# - case 't': msg_title=optarg; break; /* Report title */
20# + case 't': _("Usage Statistics for")=optarg; break; /* Report title */
21# To do it, just look at .diff files and after remove these one.
22# 5. Looked for strings that arent msg_*, like new string put with fprintf, ex.
23# fprintf(stderr,"%s %s!\n","Error: File is a symlink",log_fname);
24# in webalizer.c file
25# grep \" *.c |grep -v "_(\"" |less
26# 6. Found and change string that arent msg_* . Patch of Geolizer is an example.
27# It put messages like "Error, something..." and we need to change to _("Error, som...")
28# 7. Created webalizer.pot file with the follow command:
29# xgettext --default-domain=webalizer --directory=. -o po/webalizer.pot \
30# --language=C --add-comments="TRANS:" --escape --sort-by-file \
31# --keyword=_ --keyword=N_ --keyword=Q_ --keyword=PL_:1,2 *.c *.h
32# 8. Merged old .po files.
33# for i in po/*.po;do echo -n $i;msgmerge -U $i po/webalizer.pot;done;
34# rm -f po/*.po~;
35
36# lang_po.sh
37# --- cut here and strip all first "#" ---
38##!/bin/bash
39## create lang.txt file with vars and strings from webalizer_lang.english file
40#cat lang/webalizer_lang.english | grep ^char | sed \
41# -e 's/^char//' -e 's/ \*//' -e 's/= /=/' -e 's/ *=/=/' \
42# -e 's/="/=/' -e 's/;$//' -e 's/"$//' -e 's/!/\\!/' | \
43# grep -v "^l_month" | grep -v "^s_month" | grep -v "^h_msg" | \
44# grep -v "^language=" | sort -r > lang.txt
45## create a sed line with -e options that subst msg_* strings to _("string")
46## take strings from lang.txt file.
47#SED_E="";
48#for i in $(cat lang.txt |cut -f1 -d=); do
49# SUBST=$(cat lang.txt | grep ^$i=| cut -f2 -d=);
50# SED_E="$SED_E -e "'"'"s/$i/_("'\"'$SUBST'\"'")/"'"'
51#done;
52## create a script file with commands to subst and create a diff file
53## I create this script because had errors when I tried to run commands here.
54#echo "" > lang_po_exec.sh
55#for i in *.c; do
56# echo "cat $i | sed $SED_E > $i.new;" >> lang_po_exec.sh;
57# echo "diff -uNad $i $i.new > $i.diff;" >> lang_po_exec.sh;
58# echo "cat $i.new > $i;" >> lang_po_exec.sh;
59# echo "rm -f $i.new;" >> lang_po_exec.sh;
60#done;
61#bash ./lang_po_exec.sh;
62#rm -f lang_po_exec.sh lang.txt;
63# --- cut here ---
64
65###########################################
66# debian package won't compile
67# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=252541
68# From: Paolo <pp@ieee.org>
69# Patch to resolve little problem in gettextize
70
71###########################################
72# some messages & variables are missed while gettextize
73# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=201697
74# From: Tatsuki Sugiura <sugi@nemui.org>
75
76###########################################
77# Webalizer doesn't display 'language' anymore
78# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=202293
79# From: Fabien Chevalier <fabien@juliana-multimedia.com>
80
81
82Based on this, I applied the original patch without any part that will be
83corrected by the script.
84Also I partially regenerated the lang2.h file by using the strings from
85the new version of 'lang/webalizer_lang.english'
86This patch also generate a fixed version of the above script.
87
88It handles the following bugs as well:
89
90 * Fix report title translation handling
91 gettext patch was making ReportTitle (and -t) useless.
92 Also the fix is done in a way so that the script no longer generate wrong
93 substitutions (see point 4 above).
94
95 * Fix month translations
96 From: Gerome Fournier <gerome.fournier@infomaniak.ch>
97 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520408
98
99Index: webalizer/Makefile.in
100===================================================================
101--- webalizer.orig/Makefile.in 2011-01-07 19:11:55.000000000 +0100
102+++ webalizer/Makefile.in 2011-01-07 19:13:13.000000000 +0100
103@@ -23,10 +23,11 @@
104 BINDIR = @bindir@
105 MANDIR = ${datadir}/man/man1
106 ETCDIR = @sysconfdir@
107+LOCALEDIR = @localedir@
108 GEODB = @GEODB_LOC@
109 CC = @CC@
110 CFLAGS = @CFLAGS@ @CPPFLAGS@
111-LIBS = @LIBS@
112+LIBS = @LIBS@ -ldb
113 WCMGR_LIBS = @WCMGR_LIBS@
114 DEFS = -DETCDIR=\"${ETCDIR}\" -DGEODB_LOC=\"${GEODB}\" @DEFS@ @OPTS@
115 LDFLAGS = @LDFLAGS@
116@@ -35,6 +36,9 @@
117 INSTALL_DATA = @INSTALL_DATA@
118 DEFLANG = @DEFAULT_LANG@
119
120+LANGS=$(shell for a in po/*.po; do basename $${a%.po}; done)
121+
122+
123 # Shouldn't have to touch below here!
124
125 all: webalizer wcmgr
126@@ -43,13 +47,13 @@
127 linklist.o linklist.h preserve.o preserve.h \
128 dns_resolv.o dns_resolv.h parser.o parser.h \
129 output.o output.h graphs.o graphs.h lang.h \
130- webalizer_lang.h
131+ $(LANGS:%=po/%.mo)
132 $(CC) ${LDFLAGS} -o webalizer webalizer.o hashtab.o linklist.o preserve.o parser.o output.o dns_resolv.o graphs.o ${LIBS}
133 rm -f webazolver
134 @LN_S@ webalizer webazolver
135
136 webalizer.o: webalizer.c webalizer.h parser.h output.h preserve.h \
137- graphs.h dns_resolv.h webalizer_lang.h
138+ graphs.h dns_resolv.h
139 $(CC) ${CFLAGS} ${DEFS} -c webalizer.c
140
141 parser.o: parser.c parser.h webalizer.h lang.h
142@@ -81,14 +85,16 @@
143 wcmgr.o: wcmgr.c
144 $(CC) ${CFLAGS} ${DEFS} -c wcmgr.c
145
146+$(LANGS:%=po/%.mo): %.mo: %.po
147+ msgfmt $< -o $@
148+
149 clean:
150 rm -f webalizer webazolver wcmgr *.o usage*.png daily*.png hourly*.png
151 rm -f ctry*.png *.html *.hist *.current core *.gif
152
153 distclean: clean
154 rm -f webalizer.conf *.tar *.tgz *.Z *.tar.gz
155- rm -f Makefile webalizer_lang.h config.cache config.log config.status
156- @LN_S@ lang/webalizer_lang.@DEFAULT_LANG@ webalizer_lang.h
157+ rm -f Makefile config.cache config.log config.status $(LANGS:%=po/%.mo)
158
159 install: all
160 mkdir -p ${DESTDIR}${BINDIR}
161@@ -103,6 +109,7 @@
162 rm -f ${DESTDIR}${MANDIR}/webazolver.1
163 @LN_S@ webalizer.1 ${DESTDIR}${MANDIR}/webazolver.1
164 $(INSTALL_DATA) sample.conf ${DESTDIR}${ETCDIR}/webalizer.conf.sample
165+ for a in $(LANGS); do $(INSTALL_DATA) po/$$a.mo ${DESTDIR}/$(LOCALEDIR)/$$a/LC_MESSAGES/webalizer.mo; done
166
167 uninstall:
168 rm -f ${DESTDIR}${BINDIR}/webalizer
169@@ -112,5 +119,4 @@
170 rm -f ${DESTDIR}${MANDIR}/webazolver.1
171 rm -f ${DESTDIR}${MANDIR}/wcmgr.1
172 rm -f ${DESTDIR}${ETCDIR}/webalizer.conf.sample
173- rm -f webalizer_lang.h
174- @LN_S@ lang/webalizer_lang.${DEFLANG} webalizer_lang.h
175+ for a in $(LANGS); do rm -f $(LOCALEDIR)/$$a/LC_MESSAGES/webalizer.mo; done
176Index: webalizer/configure.in
177===================================================================
178--- webalizer.orig/configure.in 2011-01-07 19:12:51.000000000 +0100
179+++ webalizer/configure.in 2011-01-07 19:13:13.000000000 +0100
180@@ -281,43 +281,16 @@
181 if test "$OLDHASH" = "yes"; then OPTS="-DUSE_OLDHASH"; fi
182
183 dnl ------------------------------------------
184-dnl check language to use (default is english)
185+dnl language with gettext
186 dnl ------------------------------------------
187
188-LANG_CACHE=yes
189-AC_ARG_WITH(language,
190- [ --with-language=name Use language 'name' (default is english)],
191- WEBALIZER_LANG="${withval}"; LANG_CACHE=no, LANG_CACHE=yes)
192-if test "$WEBALIZER_LANG" = "no"; then WEBALIZER_LANG=english; fi
193+dnl keep datadir, it is needed for "bindtextdomain" since we use gettext
194+OPTS="-DDATADIR=\\\"${datadir}\\\" ${OPTS}"
195
196-dnl ------------------------------------------
197-dnl check if specfied language is valid
198-dnl ------------------------------------------
199-
200-AC_MSG_CHECKING(for language file)
201-if test "$LANG_CACHE" = "yes"; then
202- AC_CACHE_VAL(ac_cv_language, ac_cv_language=$DEFAULT_LANG)
203- WEBALIZER_LANG=$ac_cv_language
204-fi
205-
206-if test -f lang/webalizer_lang.${WEBALIZER_LANG}; then
207-AC_MSG_RESULT(yes - ${WEBALIZER_LANG})
208-else
209- if test -f lang/webalizer_lang.${DEFAULT_LANG}; then
210- AC_MSG_RESULT('${WEBALIZER_LANG}' not found - using ${DEFAULT_LANG})
211- WEBALIZER_LANG=${DEFAULT_LANG}
212- else
213- AC_MSG_RESULT(no)
214- AC_MSG_ERROR(language files not found... fix before continuing)
215- fi
216-fi
217-ac_cv_language=${WEBALIZER_LANG}
218-
219-dnl ------------------------------------------
220-dnl create link to language file
221-dnl ------------------------------------------
222+#AM_GNU_GETTEXT
223
224-AC_LINK_FILES(lang/webalizer_lang.${WEBALIZER_LANG}, webalizer_lang.h)
225+localedir=${datadir}/locale
226+AC_SUBST(localedir)
227
228 dnl ------------------------------------------
229 dnl done.. write out our Makefile
230Index: webalizer/dns_resolv.c
231===================================================================
232--- webalizer.orig/dns_resolv.c 2011-01-07 19:11:55.000000000 +0100
233+++ webalizer/dns_resolv.c 2011-01-07 19:13:13.000000000 +0100
234@@ -120,7 +120,7 @@
235 query.data = log_rec->hostname;
236 query.size = strlen(log_rec->hostname);
237
238- if (debug_mode) fprintf(stderr,"Checking %s...", log_rec->hostname);
239+ if (debug_mode) fprintf(stderr,_("Checking %s..."), log_rec->hostname);
240
241 if ( (i=dns_db->get(dns_db, NULL, &query, &response, 0)) == 0)
242 {
243@@ -130,15 +130,15 @@
244 MAXHOST);
245 log_rec->hostname[MAXHOST-1]=0;
246 if (debug_mode)
247- fprintf(stderr," found: %s (%ld)\n",
248+ fprintf(stderr,_(" found: %s (%ld)\n"),
249 log_rec->hostname, alignedRecord.timeStamp);
250 }
251- else /* not found or error occured during get */
252+ else /* not found or error occurred during get */
253 {
254 if (debug_mode)
255 {
256- if (i==DB_NOTFOUND) fprintf(stderr," not found\n");
257- else fprintf(stderr," error (%d)\n",i);
258+ if (i==DB_NOTFOUND) fprintf(stderr,_(" not found\n"));
259+ else fprintf(stderr,_(" error (%d)\n"),i);
260 }
261 }
262 }
263@@ -328,7 +328,7 @@
264 i=( (int)((float)listEntries/temp_time) );
265 else i=0;
266
267- if ( (i>0) && (i<=listEntries) ) printf(", %d/sec\n", i);
268+ if ( (i>0) && (i<=listEntries) ) printf(_(", %d/sec\n"), i);
269 else printf("\n");
270 }
271
272@@ -371,13 +371,13 @@
273 {
274 if(pipe(child[i].inpipe))
275 {
276- if (verbose) fprintf(stderr,"INPIPE creation error");
277+ if (verbose) fprintf(stderr,_("INPIPE creation error"));
278 return; /* exit(1) */
279 }
280
281 if(pipe(child[i].outpipe))
282 {
283- if (verbose) fprintf(stderr,"OUTPIPE creation error");
284+ if (verbose) fprintf(stderr,_("OUTPIPE creation error"));
285 return; /* exit(1); */
286 }
287
288@@ -386,7 +386,7 @@
289 {
290 case -1:
291 {
292- if (verbose) fprintf(stderr,"FORK error");
293+ if (verbose) fprintf(stderr,_("FORK error"));
294 return; /* exit(1); */
295 }
296
297@@ -402,7 +402,7 @@
298 {
299 if(size < 0)
300 {
301- perror("read error");
302+ perror(_("read error"));
303 exit(1);
304 }
305 else
306@@ -425,18 +425,18 @@
307 else
308 {
309 if (debug_mode)
310- printf("Child %d getnameinfo bad hbuf!\n",i);
311+ printf(_("Child %d getnameinfo bad hbuf!\n"),i);
312 }
313 }
314 else
315 {
316 if(debug_mode)
317- printf("Child %d getnameinfo failed!\n",i);
318+ printf(_("Child %d getnameinfo failed!\n"),i);
319 }
320
321 if (write(child[i].inpipe[1], child_buf, size) == -1)
322 {
323- perror("write error");
324+ perror(_("write error"));
325 exit(1);
326 }
327 }
328@@ -445,7 +445,7 @@
329 close(child[i].outpipe[0]);
330
331 if(debug_mode)
332- printf( "Child %d got closed input, shutting down\n", i);
333+ printf( _("Child %d got closed input, shutting down\n"), i);
334
335 fflush(stdout);
336 exit(0);
337@@ -490,7 +490,7 @@
338 nof_children--;
339
340 if(debug_mode)
341- printf("Reaped Child %d\n", pid);
342+ printf(_("Reaped Child %d\n"), pid);
343
344 break;
345 }
346@@ -519,7 +519,7 @@
347 max_fd = MAX(max_fd, child[i].inpipe[0]);
348
349 if(debug_mode)
350- printf("Giving %d bytes to Child %d\n",
351+ printf(_("Giving %d bytes to Child %d\n"),
352 trav->addrlen, i);
353
354 trav = trav->llist;
355@@ -528,7 +528,7 @@
356 {
357 if(errno != EINTR) /* Could be a signal */
358 {
359- perror("Could not write to pipe");
360+ perror(_("Could not write to pipe"));
361 close(child[i].outpipe[1]); /* kill */
362 child[i].flags &= ~DNS_CHILD_RUNNING; /* child */
363 }
364@@ -557,7 +557,7 @@
365 case -1:
366 {
367 if(errno != EINTR) /* Could be a signal */
368- perror("Error in select");
369+ perror(_("Error in select"));
370
371 break;
372 }
373@@ -565,7 +565,7 @@
374 case 0: /* Timeout, just fall once through the child loop */
375 {
376 if(debug_mode)
377- printf("tick\n");
378+ printf(_("tick\n"));
379
380 break;
381 }
382@@ -600,7 +600,7 @@
383 child[i].flags &= ~DNS_CHILD_RUNNING;
384
385 if(debug_mode)
386- printf("Child %d wants to be reaped\n", i);
387+ printf(_("Child %d wants to be reaped\n"), i);
388
389 break;
390 }
391@@ -613,14 +613,14 @@
392 sizeof(child[i].cur->addr)))
393 {
394 if(debug_mode)
395- printf("Child %d Got a result: %s -> %s\n",
396+ printf(_("Child %d Got a result: %s -> %s\n"),
397 i, child[i].cur->string, dns_buf);
398 db_put(child[i].cur->string, dns_buf, 0);
399 }
400 else
401 {
402 if(debug_mode)
403- printf("Child %d could not resolve: %s (%s)\n",
404+ printf(_("Child %d could not resolve: %s (%s)\n"),
405 i, child[i].cur->string,
406 (cache_ips)?"cache":"no cache");
407 if (cache_ips) /* Cache non-resolved? */
408@@ -629,7 +629,7 @@
409 }
410
411 if(debug_mode)
412- printf("Child %d back in task pool\n", i);
413+ printf(_("Child %d back in task pool\n"), i);
414
415 /* Child is back in the task pool */
416 child[i].flags |= DNS_CHILD_READY;
417@@ -721,7 +721,7 @@
418 v.data = recPtr;
419
420 if ( dns_db->put(dns_db, NULL, &k, &v, 0) != 0 )
421- if (verbose>1) fprintf(stderr,"db_put fail!\n");
422+ if (verbose>1) fprintf(stderr,_("db_put fail!\n"));
423 free(recPtr);
424 }
425 }
426Index: webalizer/graphs.c
427===================================================================
428--- webalizer.orig/graphs.c 2011-01-07 19:12:51.000000000 +0100
429+++ webalizer/graphs.c 2011-01-07 19:13:13.000000000 +0100
430@@ -217,12 +217,12 @@
431 if (graph_mths<16)
432 {
433 gdImageString(im,gdFontSmall,ci+((i-s_mth)*cs)+(((cw+co+co)-18)/2)+1,
434- 236,(unsigned char *)s_month[data[i].month-1],black);
435+ 236,(unsigned char *)Q_(s_month[data[i].month-1]),black);
436 }
437 else if (graph_mths<36)
438 {
439 gdImageChar(im,gdFontSmall,ci+((i-s_mth)*cs)+(((cw+co+co)-6)/2)+1,
440- 236,s_month[data[i].month-1][0],
441+ 236,Q_(s_month[data[i].month-1])[0],
442 (data[i].month==1)?blue:black);
443 }
444 else
445Index: webalizer/lang.h
446===================================================================
447--- webalizer.orig/lang.h 2011-01-07 19:12:27.000000000 +0100
448+++ webalizer/lang.h 2011-01-07 19:13:13.000000000 +0100
449@@ -1,187 +1,20 @@
450 #ifndef _LANG_H
451 #define _LANG_H
452
453-extern char *language ;
454-extern char *langcode ;
455+#include <libintl.h>
456+#include <locale.h>
457
458-extern char *msg_records ;
459-extern char *msg_addresses;
460-extern char *msg_ignored ;
461-extern char *msg_bad ;
462-extern char *msg_in ;
463-extern char *msg_seconds ;
464-
465-extern char *msg_log_err ;
466-extern char *msg_log_use ;
467-extern char *msg_dir_err ;
468-extern char *msg_dir_use ;
469-extern char *msg_cur_dir ;
470-extern char *msg_hostname;
471-extern char *msg_ign_hist;
472-extern char *msg_no_hist ;
473-extern char *msg_get_hist;
474-extern char *msg_put_hist;
475-extern char *msg_hist_err;
476-extern char *msg_bad_hist;
477-extern char *msg_bad_conf;
478-extern char *msg_bad_key ;
479-extern char *msg_bad_date;
480-extern char *msg_ign_nscp;
481-extern char *msg_bad_rec ;
482-extern char *msg_no_vrec ;
483-extern char *msg_gen_rpt ;
484-extern char *msg_gen_sum ;
485-extern char *msg_get_data;
486-extern char *msg_put_data;
487-extern char *msg_no_data ;
488-extern char *msg_bad_data;
489-extern char *msg_data_err;
490-extern char *msg_dup_data;
491-
492-extern char *msg_dns_nocf;
493-extern char *msg_dns_nodb;
494-extern char *msg_dns_nolk;
495-extern char *msg_dns_usec;
496-extern char *msg_dns_rslf;
497-extern char *msg_dns_none;
498-extern char *msg_dns_abrt;
499-
500-extern char *msg_geo_open;
501-extern char *msg_geo_use ;
502-extern char *msg_geo_nolu;
503-extern char *msg_geo_dflt;
504-
505-extern char *msg_nomem_ts;
506-extern char *msg_nomem_tr;
507-extern char *msg_nomem_tu;
508-extern char *msg_nomem_tc;
509-extern char *msg_nomem_ta;
510-extern char *msg_nomem_tsr;
511-extern char *msg_nomem_ti;
512-extern char *msg_nomem_dh;
513-extern char *msg_nomem_mh;
514-extern char *msg_nomem_u ;
515-extern char *msg_nomem_a ;
516-extern char *msg_nomem_r ;
517-extern char *msg_nomem_sc;
518-extern char *msg_nomem_i ;
519-
520-extern char *msg_big_rec ;
521-extern char *msg_big_host;
522-extern char *msg_big_date;
523-extern char *msg_big_req ;
524-extern char *msg_big_ref ;
525-extern char *msg_big_user;
526-extern char *msg_big_one ;
527+#define _(String) gettext (String)
528+#define gettext_noop(String) String
529+#define N_(String) gettext_noop (String)
530+#define Q_(String) intl_strip_context (String)
531
532-extern char *msg_no_open ;
533-
534-extern char *h_usage1 ;
535-extern char *h_usage2 ;
536 extern char *h_msg[];
537
538-/* HTML Strings */
539-
540-extern char *msg_hhdr_sp ;
541-extern char *msg_hhdr_gt ;
542-
543-extern char *msg_main_us ;
544-extern char *msg_main_per;
545-extern char *msg_main_sum;
546-extern char *msg_main_da ;
547-extern char *msg_main_mt ;
548-
549-extern char *msg_hmth_du ;
550-extern char *msg_hmth_hu ;
551-
552-extern char *msg_h_by ;
553-extern char *msg_h_avg ;
554-extern char *msg_h_max ;
555-extern char *msg_h_total ;
556-extern char *msg_h_totals;
557-extern char *msg_h_day ;
558-extern char *msg_h_mth ;
559-extern char *msg_h_hour ;
560-extern char *msg_h_hits ;
561-extern char *msg_h_pages ;
562-extern char *msg_h_visits;
563-extern char *msg_h_files ;
564-extern char *msg_h_sites ;
565-extern char *msg_h_xfer ;
566-extern char *msg_h_ixfer ;
567-extern char *msg_h_oxfer ;
568-extern char *msg_h_hname ;
569-extern char *msg_h_url ;
570-extern char *msg_h_agent ;
571-extern char *msg_h_ref ;
572-extern char *msg_h_ctry ;
573-extern char *msg_h_search;
574-extern char *msg_h_uname ;
575-
576-extern char *msg_hlnk_ds ;
577-extern char *msg_hlnk_hs ;
578-extern char *msg_hlnk_u ;
579-extern char *msg_hlnk_s ;
580-extern char *msg_hlnk_a ;
581-extern char *msg_hlnk_c ;
582-extern char *msg_hlnk_r ;
583-extern char *msg_hlnk_en ;
584-extern char *msg_hlnk_ex ;
585-extern char *msg_hlnk_sr ;
586-extern char *msg_hlnk_i ;
587-
588-extern char *msg_mtot_ms ;
589-extern char *msg_mtot_th ;
590-extern char *msg_mtot_tf ;
591-extern char *msg_mtot_tx ;
592-extern char *msg_mtot_ix ;
593-extern char *msg_mtot_ox ;
594-extern char *msg_mtot_us ;
595-extern char *msg_mtot_ur ;
596-extern char *msg_mtot_ua ;
597-extern char *msg_mtot_uu ;
598-extern char *msg_mtot_ui ;
599-extern char *msg_mtot_mhd;
600-extern char *msg_mtot_mhh;
601-extern char *msg_mtot_mfd;
602-extern char *msg_mtot_mpd;
603-extern char *msg_mtot_msd;
604-extern char *msg_mtot_mvd;
605-extern char *msg_mtot_mkd;
606-extern char *msg_mtot_ikd;
607-extern char *msg_mtot_okd;
608-extern char *msg_mtot_rc ;
609-
610-extern char *msg_dtot_ds ;
611-
612-extern char *msg_htot_hs ;
613-
614-extern char *msg_ctry_use;
615-
616-extern char *msg_top_top ;
617-extern char *msg_top_of ;
618-extern char *msg_top_s ;
619-extern char *msg_top_u ;
620-extern char *msg_top_r ;
621-extern char *msg_top_a ;
622-extern char *msg_top_c ;
623-extern char *msg_top_en ;
624-extern char *msg_top_ex ;
625-extern char *msg_top_sr ;
626-extern char *msg_top_i ;
627-extern char *msg_v_sites ;
628-extern char *msg_v_urls ;
629-extern char *msg_v_refs ;
630-extern char *msg_v_agents;
631-extern char *msg_v_search;
632-extern char *msg_v_users ;
633-
634-extern char *msg_title ;
635-extern char *msg_h_other ;
636-
637 extern char *s_month[12];
638 extern char *l_month[12];
639
640+extern char *report_title;
641 extern struct response_code response[];
642 extern struct country_code ctry[];
643
644Index: webalizer/lang2.h
645===================================================================
646--- /dev/null 1970-01-01 00:00:00.000000000 +0000
647+++ webalizer/lang2.h 2011-01-07 19:13:13.000000000 +0100
648@@ -0,0 +1,435 @@
649+/*
650+ webalizer_lang.english
651+
652+ Webalizer V2.0x Language Support file for English.
653+ 15-May-1998 by Bradford L. Barrett (brad@mrunix.net)
654+ 31-May-1998 Modified for level 1.1 support (brad@mrunix.net)
655+ 23-Jul-1998 Modified for level 1.2 support (brad@mrunix.net)
656+ 08-Mar-1999 Updated HTTP 1.1 response codes by Yves Lafon (ylafon@w3.org)
657+ 28-Jun-1999 Modified for level 1.3 support (brad@mrunix.net)
658+ 16-Feb-2000 Modified for level 2.0 support (brad@mrunix.net)
659+ 26-Mar-2008 Updated to current IANA TLDs (brad@mrunix.net)
660+ 26-May-2008 Modified for level 2.2 support (brad@mrunix.net)
661+
662+
663+ Language files are named using the following convention:
664+
665+ webalizer_lang.LANGUAGE
666+
667+ where 'LANGUAGE' is the name of the language the file is
668+ translated into (ie: webalizer_lang.russian for russian).
669+ Either copy the desired language file to webalizer_lang.h
670+ or create a symbolic link, then re-compile.
671+
672+ If you translate this file into a different language, please
673+ send a copy to brad@mrunix.net.
674+
675+*/
676+
677+/* lib gettext */
678+#include <libintl.h>
679+#include <locale.h>
680+
681+#define _(String) gettext (String)
682+#define gettext_noop(String) String
683+#define N_(String) gettext_noop (String)
684+#define Q_(String) intl_strip_context (String)
685+
686+/* Help display... */
687+char *h_msg[]= {
688+ gettext_noop("-h = print this help message") ,
689+ gettext_noop("-V = print version information") ,
690+ gettext_noop("-v = be verbose") ,
691+ gettext_noop("-d = print additional debug info") ,
692+ gettext_noop("-F type = Log type. type= (clf | ftp | squid | w3c)"),
693+ gettext_noop("-f = Fold sequence errors") ,
694+ gettext_noop("-i = ignore history file") ,
695+ gettext_noop("-p = preserve state (incremental)") ,
696+ gettext_noop("-b = ignore state (incremental)") ,
697+ gettext_noop("-q = supress informational messages") ,
698+ gettext_noop("-Q = supress _ALL_ messages") ,
699+ gettext_noop("-Y = supress country graph") ,
700+ gettext_noop("-G = supress hourly graph") ,
701+ gettext_noop("-H = supress hourly stats") ,
702+ gettext_noop("-L = supress color coded graph legends") ,
703+ gettext_noop("-l num = use num background lines on graph") ,
704+ gettext_noop("-m num = Visit timout value (seconds)") ,
705+ gettext_noop("-T = print timing information") ,
706+ gettext_noop("-c file = use configuration file 'file'") ,
707+ gettext_noop("-n name = hostname to use") ,
708+ gettext_noop("-o dir = output directory to use") ,
709+ gettext_noop("-t name = report title 'name'") ,
710+ gettext_noop("-a name = hide user agent 'name'") ,
711+ gettext_noop("-r name = hide referrer 'name'") ,
712+ gettext_noop("-s name = hide site 'name'") ,
713+ gettext_noop("-u name = hide URL 'name'") ,
714+ gettext_noop("-x name = Use filename extension 'name'") ,
715+ gettext_noop("-O name = Omit page 'name'") ,
716+ gettext_noop("-P name = Page type extension 'name'") ,
717+ gettext_noop("-I name = Index alias 'name'") ,
718+ gettext_noop("-K num = num months in summary table") ,
719+ gettext_noop("-k num = num months in summary graph") ,
720+ gettext_noop("-A num = Display num top agents") ,
721+ gettext_noop("-C num = Display num top countries") ,
722+ gettext_noop("-R num = Display num top referrers") ,
723+ gettext_noop("-S num = Display num top sites") ,
724+ gettext_noop("-U num = Display num top URLs") ,
725+ gettext_noop("-e num = Display num top Entry Pages") ,
726+ gettext_noop("-E num = Display num top Exit Pages") ,
727+ gettext_noop("-g num = Group Domains to 'num' levels") ,
728+ gettext_noop("-X = Hide individual sites") ,
729+ gettext_noop("-z dir = Use country flags in 'dir'") ,
730+#ifdef USE_DNS
731+ gettext_noop("-D name = Use DNS Cache file 'name'") ,
732+ gettext_noop("-N num = Number of DNS processes (0=disable)") ,
733+ gettext_noop("-j = Enable native GeoDB lookups") ,
734+ gettext_noop("-J name = Use GeoDB database 'name'") ,
735+#endif
736+#ifdef USE_GEOIP
737+ gettext_noop("-w = Enable GeoIP lookups") ,
738+ gettext_noop("-W name = Use GeoIP database 'name'") ,
739+#endif
740+ NULL};
741+
742+/* short month names MUST BE 3 CHARS in size... pad if needed*/
743+char *s_month[12]={ gettext_noop("Jan"), gettext_noop("Feb"), gettext_noop("Mar"),
744+ gettext_noop("Apr"), gettext_noop("short|May"), gettext_noop("Jun"),
745+ gettext_noop("Jul"), gettext_noop("Aug"), gettext_noop("Sep"),
746+ gettext_noop("Oct"), gettext_noop("Nov"), gettext_noop("Dec")};
747+
748+/* long month names - can be any length */
749+char *l_month[12]={ gettext_noop("January"), gettext_noop("February"), gettext_noop("March"),
750+ gettext_noop("April"), gettext_noop("long|May"), gettext_noop("June"),
751+ gettext_noop("July"), gettext_noop("August"), gettext_noop("September"),
752+ gettext_noop("October"), gettext_noop("November"),gettext_noop("December")};
753+
754+/* response code descriptions... order IS important! */
755+struct response_code response[] =
756+ { { gettext_noop("Undefined response code"), 0 },
757+ { gettext_noop("Code 100 - Continue"), 0 },
758+ { gettext_noop("Code 101 - Switching Protocols"), 0 },
759+ { gettext_noop("Code 200 - OK"), 0 },
760+ { gettext_noop("Code 201 - Created"), 0 },
761+ { gettext_noop("Code 202 - Accepted"), 0 },
762+ { gettext_noop("Code 203 - Non-Authoritative Information"), 0 },
763+ { gettext_noop("Code 204 - No Content"), 0 },
764+ { gettext_noop("Code 205 - Reset Content"), 0 },
765+ { gettext_noop("Code 206 - Partial Content"), 0 },
766+ { gettext_noop("Code 300 - Multiple Choices"), 0 },
767+ { gettext_noop("Code 301 - Moved Permanently"), 0 },
768+ { gettext_noop("Code 302 - Found"), 0 },
769+ { gettext_noop("Code 303 - See Other"), 0 },
770+ { gettext_noop("Code 304 - Not Modified"), 0 },
771+ { gettext_noop("Code 305 - Use Proxy"), 0 },
772+ { gettext_noop("Code 307 - Moved Temporarily"), 0 },
773+ { gettext_noop("Code 400 - Bad Request"), 0 },
774+ { gettext_noop("Code 401 - Unauthorized"), 0 },
775+ { gettext_noop("Code 402 - Payment Required"), 0 },
776+ { gettext_noop("Code 403 - Forbidden"), 0 },
777+ { gettext_noop("Code 404 - Not Found"), 0 },
778+ { gettext_noop("Code 405 - Method Not Allowed"), 0 },
779+ { gettext_noop("Code 406 - Not Acceptable"), 0 },
780+ { gettext_noop("Code 407 - Proxy Authentication Required"), 0 },
781+ { gettext_noop("Code 408 - Request Timeout"), 0 },
782+ { gettext_noop("Code 409 - Conflict"), 0 },
783+ { gettext_noop("Code 410 - Gone"), 0 },
784+ { gettext_noop("Code 411 - Length Required"), 0 },
785+ { gettext_noop("Code 412 - Precondition Failed"), 0 },
786+ { gettext_noop("Code 413 - Request Entity Too Large"), 0 },
787+ { gettext_noop("Code 414 - Request-URI Too Long"), 0 },
788+ { gettext_noop("Code 415 - Unsupported Media Type"), 0 },
789+ { gettext_noop("Code 416 - Requested Range Not Satisfiable"), 0 },
790+ { gettext_noop("Code 417 - Expectation Failed"), 0 },
791+ { gettext_noop("Code 500 - Internal Server Error"), 0 },
792+ { gettext_noop("Code 501 - Not Implemented"), 0 },
793+ { gettext_noop("Code 502 - Bad Gateway"), 0 },
794+ { gettext_noop("Code 503 - Service Unavailable"), 0 },
795+ { gettext_noop("Code 504 - Gateway Timeout"), 0 },
796+ { gettext_noop("Code 505 - HTTP Version Not Supported"), 0 } };
797+
798+char *report_title;
799+
800+/* Country codes (previously in ctry.h header file) */
801+
802+struct country_code ctry[] = {
803+{ 0, gettext_noop("Unresolved/Unknown"), 0,0,0 },
804+{ IDX_3C('c','o','m'), gettext_noop("Commercial (com)"), 0,0,0 },
805+{ IDX_3C('e','d','u'), gettext_noop("Educational (edu)"), 0,0,0 },
806+{ IDX_3C('g','o','v'), gettext_noop("US Government (gov)"), 0,0,0 },
807+{ IDX_3C('i','n','t'), gettext_noop("International (int)"), 0,0,0 },
808+{ IDX_3C('m','i','l'), gettext_noop("US Military (mil)"), 0,0,0 },
809+{ IDX_3C('n','e','t'), gettext_noop("Network (net)"), 0,0,0 },
810+{ IDX_3C('o','r','g'), gettext_noop("Non-Profit (org)"), 0,0,0 },
811+{ IDX_3C('b','i','z'), gettext_noop("Generic Business (biz)"), 0,0,0 },
812+{ IDX_3C('c','a','t'), gettext_noop("Catalan Community (cat)"), 0,0,0 },
813+{ IDX_3C('p','r','o'), gettext_noop("Professional (pro)"), 0,0,0 },
814+{ IDX_3C('t','e','l'), gettext_noop("Ind. Contact Data (tel)"), 0,0,0 },
815+{ IDX_4C('a','e','r','o'),gettext_noop("Air Transport Industry (aero)"), 0,0,0 },
816+{ IDX_4C('a','s','i','a'),gettext_noop("Asia Pacific Community (asia)"), 0,0,0 },
817+{ IDX_4C('c','o','o','p'),gettext_noop("Cooperative Association (coop)"), 0,0,0 },
818+{ IDX_4C('i','n','f','o'),gettext_noop("Generic TLD (info)"), 0,0,0 },
819+{ IDX_4C('j','o','b','s'),gettext_noop("Human Resources (jobs)"), 0,0,0 },
820+{ IDX_4C('m','o','b','i'),gettext_noop("Generic Mobile TLD (mobi)"), 0,0,0 },
821+{ IDX_4C('n','a','m','e'),gettext_noop("Individual (name)"), 0,0,0 },
822+{ IDX_4C('a','r','p','a'),gettext_noop("Address Routing (arpa)"), 0,0,0 },
823+{ IDX_4C('n','a','t','o'),gettext_noop("Nato field (nato)"), 0,0,0 },
824+{ IDX_6C('m','u','s','e','u','m'), gettext_noop("Museums (museum)"), 0,0,0 },
825+{ IDX_6C('t','r','a','v','e','l'), gettext_noop("Travel Ind. (travel)"), 0,0,0 },
826+{ IDX_2C('a','c'), gettext_noop("Ascension Island"), 0,0,0 },
827+{ IDX_2C('a','d'), gettext_noop("Andorra"), 0,0,0 },
828+{ IDX_2C('a','e'), gettext_noop("United Arab Emirates"), 0,0,0 },
829+{ IDX_2C('a','f'), gettext_noop("Afghanistan"), 0,0,0 },
830+{ IDX_2C('a','g'), gettext_noop("Antigua and Barbuda"), 0,0,0 },
831+{ IDX_2C('a','i'), gettext_noop("Anguilla"), 0,0,0 },
832+{ IDX_2C('a','l'), gettext_noop("Albania"), 0,0,0 },
833+{ IDX_2C('a','m'), gettext_noop("Armenia"), 0,0,0 },
834+{ IDX_2C('a','n'), gettext_noop("Netherlands Antilles"), 0,0,0 },
835+{ IDX_2C('a','o'), gettext_noop("Angola"), 0,0,0 },
836+{ IDX_2C('a','q'), gettext_noop("Antarctica"), 0,0,0 },
837+{ IDX_2C('a','r'), gettext_noop("Argentina"), 0,0,0 },
838+{ IDX_2C('a','s'), gettext_noop("American Samoa"), 0,0,0 },
839+{ IDX_2C('a','t'), gettext_noop("Austria"), 0,0,0 },
840+{ IDX_2C('a','u'), gettext_noop("Australia"), 0,0,0 },
841+{ IDX_2C('a','w'), gettext_noop("Aruba"), 0,0,0 },
842+{ IDX_2C('a','x'), gettext_noop("Aland Islands"), 0,0,0 },
843+{ IDX_2C('a','z'), gettext_noop("Azerbaijan"), 0,0,0 },
844+{ IDX_2C('b','a'), gettext_noop("Bosnia and Herzegovina"), 0,0,0 },
845+{ IDX_2C('b','b'), gettext_noop("Barbados"), 0,0,0 },
846+{ IDX_2C('b','d'), gettext_noop("Bangladesh"), 0,0,0 },
847+{ IDX_2C('b','e'), gettext_noop("Belgium"), 0,0,0 },
848+{ IDX_2C('b','f'), gettext_noop("Burkina Faso"), 0,0,0 },
849+{ IDX_2C('b','g'), gettext_noop("Bulgaria"), 0,0,0 },
850+{ IDX_2C('b','h'), gettext_noop("Bahrain"), 0,0,0 },
851+{ IDX_2C('b','i'), gettext_noop("Burundi"), 0,0,0 },
852+{ IDX_2C('b','j'), gettext_noop("Benin"), 0,0,0 },
853+{ IDX_2C('b','l'), gettext_noop("Saint Barthelemy"), 0,0,0 },
854+{ IDX_2C('b','m'), gettext_noop("Bermuda"), 0,0,0 },
855+{ IDX_2C('b','n'), gettext_noop("Brunei Darussalam"), 0,0,0 },
856+{ IDX_2C('b','o'), gettext_noop("Bolivia"), 0,0,0 },
857+{ IDX_2C('b','r'), gettext_noop("Brazil"), 0,0,0 },
858+{ IDX_2C('b','s'), gettext_noop("Bahamas"), 0,0,0 },
859+{ IDX_2C('b','t'), gettext_noop("Bhutan"), 0,0,0 },
860+{ IDX_2C('b','v'), gettext_noop("Bouvet Island"), 0,0,0 },
861+{ IDX_2C('b','w'), gettext_noop("Botswana"), 0,0,0 },
862+{ IDX_2C('b','y'), gettext_noop("Belarus"), 0,0,0 },
863+{ IDX_2C('b','z'), gettext_noop("Belize"), 0,0,0 },
864+{ IDX_2C('c','a'), gettext_noop("Canada"), 0,0,0 },
865+{ IDX_2C('c','c'), gettext_noop("Cocos (Keeling) Islands"), 0,0,0 },
866+{ IDX_2C('c','d'), gettext_noop("Congo, Democratic Republic"), 0,0,0 },
867+{ IDX_2C('c','f'), gettext_noop("Central African Republic"), 0,0,0 },
868+{ IDX_2C('c','g'), gettext_noop("Congo"), 0,0,0 },
869+{ IDX_2C('c','h'), gettext_noop("Switzerland"), 0,0,0 },
870+{ IDX_2C('c','i'), gettext_noop("Cote D'Ivoire (Ivory Coast)"), 0,0,0 },
871+{ IDX_2C('c','k'), gettext_noop("Cook Islands"), 0,0,0 },
872+{ IDX_2C('c','l'), gettext_noop("Chile"), 0,0,0 },
873+{ IDX_2C('c','m'), gettext_noop("Cameroon"), 0,0,0 },
874+{ IDX_2C('c','n'), gettext_noop("China"), 0,0,0 },
875+{ IDX_2C('c','o'), gettext_noop("Colombia"), 0,0,0 },
876+{ IDX_2C('c','r'), gettext_noop("Costa Rica"), 0,0,0 },
877+{ IDX_2C('c','u'), gettext_noop("Cuba"), 0,0,0 },
878+{ IDX_2C('c','v'), gettext_noop("Cape Verde"), 0,0,0 },
879+{ IDX_2C('c','x'), gettext_noop("Christmas Island"), 0,0,0 },
880+{ IDX_2C('c','y'), gettext_noop("Cyprus"), 0,0,0 },
881+{ IDX_2C('c','z'), gettext_noop("Czech Republic"), 0,0,0 },
882+{ IDX_2C('d','e'), gettext_noop("Germany"), 0,0,0 },
883+{ IDX_2C('d','j'), gettext_noop("Djibouti"), 0,0,0 },
884+{ IDX_2C('d','k'), gettext_noop("Denmark"), 0,0,0 },
885+{ IDX_2C('d','m'), gettext_noop("Dominica"), 0,0,0 },
886+{ IDX_2C('d','o'), gettext_noop("Dominican Republic"), 0,0,0 },
887+{ IDX_2C('d','z'), gettext_noop("Algeria"), 0,0,0 },
888+{ IDX_2C('e','c'), gettext_noop("Ecuador"), 0,0,0 },
889+{ IDX_2C('e','e'), gettext_noop("Estonia"), 0,0,0 },
890+{ IDX_2C('e','g'), gettext_noop("Egypt"), 0,0,0 },
891+{ IDX_2C('e','h'), gettext_noop("Western Sahara"), 0,0,0 },
892+{ IDX_2C('e','r'), gettext_noop("Eritrea"), 0,0,0 },
893+{ IDX_2C('e','s'), gettext_noop("Spain"), 0,0,0 },
894+{ IDX_2C('e','t'), gettext_noop("Ethiopia"), 0,0,0 },
895+{ IDX_2C('e','u'), gettext_noop("European Union"), 0,0,0 },
896+{ IDX_2C('f','i'), gettext_noop("Finland"), 0,0,0 },
897+{ IDX_2C('f','j'), gettext_noop("Fiji"), 0,0,0 },
898+{ IDX_2C('f','k'), gettext_noop("Falkland Islands (Malvinas)"), 0,0,0 },
899+{ IDX_2C('f','m'), gettext_noop("Micronesia"), 0,0,0 },
900+{ IDX_2C('f','o'), gettext_noop("Faroe Islands"), 0,0,0 },
901+{ IDX_2C('f','r'), gettext_noop("France"), 0,0,0 },
902+{ IDX_2C('g','a'), gettext_noop("Gabon"), 0,0,0 },
903+{ IDX_2C('g','b'), gettext_noop("Great Britain (UK)"), 0,0,0 },
904+{ IDX_2C('g','d'), gettext_noop("Grenada"), 0,0,0 },
905+{ IDX_2C('g','e'), gettext_noop("Georgia"), 0,0,0 },
906+{ IDX_2C('g','f'), gettext_noop("French Guiana"), 0,0,0 },
907+{ IDX_2C('g','g'), gettext_noop("Guernsey"), 0,0,0 },
908+{ IDX_2C('g','h'), gettext_noop("Ghana"), 0,0,0 },
909+{ IDX_2C('g','i'), gettext_noop("Gibraltar"), 0,0,0 },
910+{ IDX_2C('g','l'), gettext_noop("Greenland"), 0,0,0 },
911+{ IDX_2C('g','m'), gettext_noop("Gambia"), 0,0,0 },
912+{ IDX_2C('g','n'), gettext_noop("Guinea"), 0,0,0 },
913+{ IDX_2C('g','p'), gettext_noop("Guadeloupe"), 0,0,0 },
914+{ IDX_2C('g','q'), gettext_noop("Equatorial Guinea"), 0,0,0 },
915+{ IDX_2C('g','r'), gettext_noop("Greece"), 0,0,0 },
916+{ IDX_2C('g','s'), gettext_noop("S. Georgia and S. Sandwich Isls."), 0,0,0 },
917+{ IDX_2C('g','t'), gettext_noop("Guatemala"), 0,0,0 },
918+{ IDX_2C('g','u'), gettext_noop("Guam"), 0,0,0 },
919+{ IDX_2C('g','w'), gettext_noop("Guinea-Bissau"), 0,0,0 },
920+{ IDX_2C('g','y'), gettext_noop("Guyana"), 0,0,0 },
921+{ IDX_2C('h','k'), gettext_noop("Hong Kong"), 0,0,0 },
922+{ IDX_2C('h','m'), gettext_noop("Heard and McDonald Islands"), 0,0,0 },
923+{ IDX_2C('h','n'), gettext_noop("Honduras"), 0,0,0 },
924+{ IDX_2C('h','r'), gettext_noop("Croatia"), 0,0,0 },
925+{ IDX_2C('h','t'), gettext_noop("Haiti"), 0,0,0 },
926+{ IDX_2C('h','u'), gettext_noop("Hungary"), 0,0,0 },
927+{ IDX_2C('i','d'), gettext_noop("Indonesia"), 0,0,0 },
928+{ IDX_2C('i','e'), gettext_noop("Ireland"), 0,0,0 },
929+{ IDX_2C('i','l'), gettext_noop("Israel"), 0,0,0 },
930+{ IDX_2C('i','m'), gettext_noop("Isle of Man"), 0,0,0 },
931+{ IDX_2C('i','n'), gettext_noop("India"), 0,0,0 },
932+{ IDX_2C('i','o'), gettext_noop("British Indian Ocean Territory"), 0,0,0 },
933+{ IDX_2C('i','q'), gettext_noop("Iraq"), 0,0,0 },
934+{ IDX_2C('i','r'), gettext_noop("Iran"), 0,0,0 },
935+{ IDX_2C('i','s'), gettext_noop("Iceland"), 0,0,0 },
936+{ IDX_2C('i','t'), gettext_noop("Italy"), 0,0,0 },
937+{ IDX_2C('j','e'), gettext_noop("Jersey"), 0,0,0 },
938+{ IDX_2C('j','m'), gettext_noop("Jamaica"), 0,0,0 },
939+{ IDX_2C('j','o'), gettext_noop("Jordan"), 0,0,0 },
940+{ IDX_2C('j','p'), gettext_noop("Japan"), 0,0,0 },
941+{ IDX_2C('k','e'), gettext_noop("Kenya"), 0,0,0 },
942+{ IDX_2C('k','g'), gettext_noop("Kyrgyzstan"), 0,0,0 },
943+{ IDX_2C('k','h'), gettext_noop("Cambodia"), 0,0,0 },
944+{ IDX_2C('k','i'), gettext_noop("Kiribati"), 0,0,0 },
945+{ IDX_2C('k','m'), gettext_noop("Comoros"), 0,0,0 },
946+{ IDX_2C('k','n'), gettext_noop("Saint Kitts and Nevis"), 0,0,0 },
947+{ IDX_2C('k','p'), gettext_noop("Korea, Democratic Republic of"), 0,0,0 },
948+{ IDX_2C('k','r'), gettext_noop("Korea, Republic of"), 0,0,0 },
949+{ IDX_2C('k','w'), gettext_noop("Kuwait"), 0,0,0 },
950+{ IDX_2C('k','y'), gettext_noop("Cayman Islands"), 0,0,0 },
951+{ IDX_2C('k','z'), gettext_noop("Kazakhstan"), 0,0,0 },
952+{ IDX_2C('l','a'), gettext_noop("Laos"), 0,0,0 },
953+{ IDX_2C('l','b'), gettext_noop("Lebanon"), 0,0,0 },
954+{ IDX_2C('l','c'), gettext_noop("Saint Lucia"), 0,0,0 },
955+{ IDX_2C('l','i'), gettext_noop("Liechtenstein"), 0,0,0 },
956+{ IDX_2C('l','k'), gettext_noop("Sri Lanka"), 0,0,0 },
957+{ IDX_2C('l','r'), gettext_noop("Liberia"), 0,0,0 },
958+{ IDX_2C('l','s'), gettext_noop("Lesotho"), 0,0,0 },
959+{ IDX_2C('l','t'), gettext_noop("Lithuania"), 0,0,0 },
960+{ IDX_2C('l','u'), gettext_noop("Luxembourg"), 0,0,0 },
961+{ IDX_2C('l','v'), gettext_noop("Latvia"), 0,0,0 },
962+{ IDX_2C('l','y'), gettext_noop("Libya"), 0,0,0 },
963+{ IDX_2C('m','a'), gettext_noop("Morocco"), 0,0,0 },
964+{ IDX_2C('m','c'), gettext_noop("Monaco"), 0,0,0 },
965+{ IDX_2C('m','d'), gettext_noop("Moldova"), 0,0,0 },
966+{ IDX_2C('m','e'), gettext_noop("Montenegro"), 0,0,0 },
967+{ IDX_2C('m','f'), gettext_noop("Saint Martin (French part)"), 0,0,0 },
968+{ IDX_2C('m','g'), gettext_noop("Madagascar"), 0,0,0 },
969+{ IDX_2C('m','h'), gettext_noop("Marshall Islands"), 0,0,0 },
970+{ IDX_2C('m','k'), gettext_noop("Macedonia"), 0,0,0 },
971+{ IDX_2C('m','l'), gettext_noop("Mali"), 0,0,0 },
972+{ IDX_2C('m','m'), gettext_noop("Myanmar"), 0,0,0 },
973+{ IDX_2C('m','n'), gettext_noop("Mongolia"), 0,0,0 },
974+{ IDX_2C('m','o'), gettext_noop("Macau"), 0,0,0 },
975+{ IDX_2C('m','p'), gettext_noop("Northern Mariana Islands"), 0,0,0 },
976+{ IDX_2C('m','q'), gettext_noop("Martinique"), 0,0,0 },
977+{ IDX_2C('m','r'), gettext_noop("Mauritania"), 0,0,0 },
978+{ IDX_2C('m','s'), gettext_noop("Montserrat"), 0,0,0 },
979+{ IDX_2C('m','t'), gettext_noop("Malta"), 0,0,0 },
980+{ IDX_2C('m','u'), gettext_noop("Mauritius"), 0,0,0 },
981+{ IDX_2C('m','v'), gettext_noop("Maldives"), 0,0,0 },
982+{ IDX_2C('m','w'), gettext_noop("Malawi"), 0,0,0 },
983+{ IDX_2C('m','x'), gettext_noop("Mexico"), 0,0,0 },
984+{ IDX_2C('m','y'), gettext_noop("Malaysia"), 0,0,0 },
985+{ IDX_2C('m','z'), gettext_noop("Mozambique"), 0,0,0 },
986+{ IDX_2C('n','a'), gettext_noop("Namibia"), 0,0,0 },
987+{ IDX_2C('n','c'), gettext_noop("New Caledonia"), 0,0,0 },
988+{ IDX_2C('n','e'), gettext_noop("Niger"), 0,0,0 },
989+{ IDX_2C('n','f'), gettext_noop("Norfolk Island"), 0,0,0 },
990+{ IDX_2C('n','g'), gettext_noop("Nigeria"), 0,0,0 },
991+{ IDX_2C('n','i'), gettext_noop("Nicaragua"), 0,0,0 },
992+{ IDX_2C('n','l'), gettext_noop("Netherlands"), 0,0,0 },
993+{ IDX_2C('n','o'), gettext_noop("Norway"), 0,0,0 },
994+{ IDX_2C('n','p'), gettext_noop("Nepal"), 0,0,0 },
995+{ IDX_2C('n','r'), gettext_noop("Nauru"), 0,0,0 },
996+{ IDX_2C('n','u'), gettext_noop("Niue"), 0,0,0 },
997+{ IDX_2C('n','z'), gettext_noop("New Zealand"), 0,0,0 },
998+{ IDX_2C('o','m'), gettext_noop("Oman"), 0,0,0 },
999+{ IDX_2C('p','a'), gettext_noop("Panama"), 0,0,0 },
1000+{ IDX_2C('p','e'), gettext_noop("Peru"), 0,0,0 },
1001+{ IDX_2C('p','f'), gettext_noop("French Polynesia"), 0,0,0 },
1002+{ IDX_2C('p','g'), gettext_noop("Papua New Guinea"), 0,0,0 },
1003+{ IDX_2C('p','h'), gettext_noop("Philippines"), 0,0,0 },
1004+{ IDX_2C('p','k'), gettext_noop("Pakistan"), 0,0,0 },
1005+{ IDX_2C('p','l'), gettext_noop("Poland"), 0,0,0 },
1006+{ IDX_2C('p','m'), gettext_noop("St. Pierre and Miquelon"), 0,0,0 },
1007+{ IDX_2C('p','n'), gettext_noop("Pitcairn"), 0,0,0 },
1008+{ IDX_2C('p','r'), gettext_noop("Puerto Rico"), 0,0,0 },
1009+{ IDX_2C('p','s'), gettext_noop("Palestinian Territory, Occupied"), 0,0,0 },
1010+{ IDX_2C('p','t'), gettext_noop("Portugal"), 0,0,0 },
1011+{ IDX_2C('p','w'), gettext_noop("Palau"), 0,0,0 },
1012+{ IDX_2C('p','y'), gettext_noop("Paraguay"), 0,0,0 },
1013+{ IDX_2C('q','a'), gettext_noop("Qatar"), 0,0,0 },
1014+{ IDX_2C('r','e'), gettext_noop("Reunion"), 0,0,0 },
1015+{ IDX_2C('r','o'), gettext_noop("Romania"), 0,0,0 },
1016+{ IDX_2C('r','s'), gettext_noop("Serbia"), 0,0,0 },
1017+{ IDX_2C('r','u'), gettext_noop("Russian Federation"), 0,0,0 },
1018+{ IDX_2C('r','w'), gettext_noop("Rwanda"), 0,0,0 },
1019+{ IDX_2C('s','a'), gettext_noop("Saudi Arabia"), 0,0,0 },
1020+{ IDX_2C('s','b'), gettext_noop("Solomon Islands"), 0,0,0 },
1021+{ IDX_2C('s','c'), gettext_noop("Seychelles"), 0,0,0 },
1022+{ IDX_2C('s','d'), gettext_noop("Sudan"), 0,0,0 },
1023+{ IDX_2C('s','e'), gettext_noop("Sweden"), 0,0,0 },
1024+{ IDX_2C('s','g'), gettext_noop("Singapore"), 0,0,0 },
1025+{ IDX_2C('s','h'), gettext_noop("St. Helena"), 0,0,0 },
1026+{ IDX_2C('s','i'), gettext_noop("Slovenia"), 0,0,0 },
1027+{ IDX_2C('s','j'), gettext_noop("Svalbard and Jan Mayen Islands"), 0,0,0 },
1028+{ IDX_2C('s','k'), gettext_noop("Slovakia"), 0,0,0 },
1029+{ IDX_2C('s','l'), gettext_noop("Sierra Leone"), 0,0,0 },
1030+{ IDX_2C('s','m'), gettext_noop("San Marino"), 0,0,0 },
1031+{ IDX_2C('s','n'), gettext_noop("Senegal"), 0,0,0 },
1032+{ IDX_2C('s','o'), gettext_noop("Somalia"), 0,0,0 },
1033+{ IDX_2C('s','r'), gettext_noop("Suriname"), 0,0,0 },
1034+{ IDX_2C('s','t'), gettext_noop("Sao Tome and Principe"), 0,0,0 },
1035+{ IDX_2C('s','u'), gettext_noop("Soviet Union"), 0,0,0 },
1036+{ IDX_2C('s','v'), gettext_noop("El Salvador"), 0,0,0 },
1037+{ IDX_2C('s','y'), gettext_noop("Syrian Arab Republic"), 0,0,0 },
1038+{ IDX_2C('s','z'), gettext_noop("Swaziland"), 0,0,0 },
1039+{ IDX_2C('t','c'), gettext_noop("Turks and Caicos Islands"), 0,0,0 },
1040+{ IDX_2C('t','d'), gettext_noop("Chad"), 0,0,0 },
1041+{ IDX_2C('t','f'), gettext_noop("French Southern Territories"), 0,0,0 },
1042+{ IDX_2C('t','g'), gettext_noop("Togo"), 0,0,0 },
1043+{ IDX_2C('t','h'), gettext_noop("Thailand"), 0,0,0 },
1044+{ IDX_2C('t','j'), gettext_noop("Tajikistan"), 0,0,0 },
1045+{ IDX_2C('t','k'), gettext_noop("Tokelau"), 0,0,0 },
1046+{ IDX_2C('t','l'), gettext_noop("Timor-Leste"), 0,0,0 },
1047+{ IDX_2C('t','m'), gettext_noop("Turkmenistan"), 0,0,0 },
1048+{ IDX_2C('t','n'), gettext_noop("Tunisia"), 0,0,0 },
1049+{ IDX_2C('t','o'), gettext_noop("Tonga"), 0,0,0 },
1050+{ IDX_2C('t','p'), gettext_noop("Portuguese Timor"), 0,0,0 },
1051+{ IDX_2C('t','r'), gettext_noop("Turkey"), 0,0,0 },
1052+{ IDX_2C('t','t'), gettext_noop("Trinidad and Tobago"), 0,0,0 },
1053+{ IDX_2C('t','v'), gettext_noop("Tuvalu"), 0,0,0 },
1054+{ IDX_2C('t','w'), gettext_noop("Taiwan"), 0,0,0 },
1055+{ IDX_2C('t','z'), gettext_noop("Tanzania"), 0,0,0 },
1056+{ IDX_2C('u','a'), gettext_noop("Ukraine"), 0,0,0 },
1057+{ IDX_2C('u','g'), gettext_noop("Uganda"), 0,0,0 },
1058+{ IDX_2C('u','k'), gettext_noop("United Kingdom"), 0,0,0 },
1059+{ IDX_2C('u','m'), gettext_noop("US Minor Outlying Islands"), 0,0,0 },
1060+{ IDX_2C('u','s'), gettext_noop("United States"), 0,0,0 },
1061+{ IDX_2C('u','y'), gettext_noop("Uruguay"), 0,0,0 },
1062+{ IDX_2C('u','z'), gettext_noop("Uzbekistan"), 0,0,0 },
1063+{ IDX_2C('v','a'), gettext_noop("Vatican City State (Holy See)"), 0,0,0 },
1064+{ IDX_2C('v','c'), gettext_noop("Saint Vincent and the Grenadines"), 0,0,0 },
1065+{ IDX_2C('v','e'), gettext_noop("Venezuela"), 0,0,0 },
1066+{ IDX_2C('v','g'), gettext_noop("Virgin Islands (British)"), 0,0,0 },
1067+{ IDX_2C('v','i'), gettext_noop("Virgin Islands (U.S.)"), 0,0,0 },
1068+{ IDX_2C('v','n'), gettext_noop("Vietnam"), 0,0,0 },
1069+{ IDX_2C('v','u'), gettext_noop("Vanuatu"), 0,0,0 },
1070+{ IDX_2C('w','f'), gettext_noop("Wallis and Futuna Islands"), 0,0,0 },
1071+{ IDX_2C('w','s'), gettext_noop("Samoa"), 0,0,0 },
1072+{ IDX_2C('y','e'), gettext_noop("Yemen"), 0,0,0 },
1073+{ IDX_2C('y','t'), gettext_noop("Mayotte"), 0,0,0 },
1074+{ IDX_2C('y','u'), gettext_noop("Yugoslavia"), 0,0,0 },
1075+{ IDX_2C('z','a'), gettext_noop("South Africa"), 0,0,0 },
1076+{ IDX_2C('z','m'), gettext_noop("Zambia"), 0,0,0 },
1077+{ IDX_2C('z','w'), gettext_noop("Zimbabwe"), 0,0,0 },
1078+{ IDX_2C('a','1'), gettext_noop("Anonymous Proxy"), 0,0,0 },
1079+{ IDX_2C('a','2'), gettext_noop("Satellite Provider"), 0,0,0 },
1080+{ IDX_2C('o','1'), gettext_noop("Other"), 0,0,0 },
1081+{ IDX_2C('a','p'), gettext_noop("Asia/Pacific Region"), 0,0,0 },
1082+{ IDX_3C('l','a','n'), gettext_noop("Local Network (lan)"), 0,0,0 },
1083+{ 0 , NULL, 0,0,0 }};
1084Index: webalizer/lang_po.sh
1085===================================================================
1086--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1087+++ webalizer/lang_po.sh 2011-01-07 19:13:13.000000000 +0100
1088@@ -0,0 +1,24 @@
1089+#!/bin/bash
1090+# create lang.txt file with vars and strings from webalizer_lang.english file
1091+cat lang/webalizer_lang.english | grep ^char | sed \
1092+ -e 's/^char//' -e 's/ \*//' -e 's/= /=/' -e 's/ *=/=/' \
1093+ -e 's/="/=/' -e 's/;$//' -e 's/"$//' -e 's/!/\\!/' | \
1094+ grep -v "^l_month" | grep -v "^s_month" | grep -v "^h_msg" | \
1095+ grep -v "^language=" | sort -r > lang.txt
1096+# create a sed line with -e options that subst msg_* strings to _("string")
1097+# take strings from lang.txt file.
1098+SED_E="";
1099+for i in $(cat lang.txt |cut -f1 -d=); do
1100+ SUBST=$(cat lang.txt | grep ^$i=| cut -f2 -d=);
1101+ SED_E="$SED_E -e "'"'"s/\<$i\>/_("'\"'$SUBST'\"'")/"'"'
1102+done;
1103+# create a script file with commands to subst and create a diff file
1104+# I create this script because had errors when I tried to run commands here.
1105+echo "" > lang_po_exec.sh
1106+for i in *.c; do
1107+ echo "cat $i | sed $SED_E > $i.new;" >> lang_po_exec.sh;
1108+ echo "cat $i.new > $i;" >> lang_po_exec.sh;
1109+ echo "rm -f $i.new;" >> lang_po_exec.sh;
1110+done;
1111+bash ./lang_po_exec.sh;
1112+rm -f lang_po_exec.sh lang.txt;
1113Index: webalizer/output.c
1114===================================================================
1115--- webalizer.orig/output.c 2011-01-07 19:12:31.000000000 +0100
1116+++ webalizer/output.c 2011-01-07 19:13:13.000000000 +0100
1117@@ -191,7 +191,7 @@
1118
1119 fprintf(out_fp,"<HTML lang=\"%s\">\n<HEAD>\n",langcode);
1120 fprintf(out_fp," <TITLE>%s %s - %s</TITLE>\n",
1121- msg_title, hname, (period)?period:msg_main_per);
1122+ report_title, hname, (period)?period:msg_main_per);
1123 lptr=html_head;
1124 while (lptr!=NULL)
1125 {
1126@@ -213,7 +213,7 @@
1127 lptr=lptr->next;
1128 }
1129 }
1130- fprintf(out_fp,"<H2>%s %s</H2>\n",msg_title, hname);
1131+ fprintf(out_fp,"<H2>%s %s</H2>\n",report_title, hname);
1132 if (period)
1133 fprintf(out_fp,"<SMALL><STRONG>\n%s: %s<BR>\n",msg_hhdr_sp,period);
1134 else
1135@@ -289,7 +289,7 @@
1136 char htitle[256];
1137
1138 if (verbose>1)
1139- printf("%s %s %d\n",msg_gen_rpt, l_month[cur_month-1], cur_year);
1140+ printf("%s %s %d\n",msg_gen_rpt, Q_(l_month[cur_month-1]), cur_year);
1141
1142 /* fill in filenames */
1143 snprintf(html_fname,sizeof(html_fname),"usage_%04d%02d.%s",
1144@@ -301,7 +301,7 @@
1145 if (daily_graph)
1146 {
1147 snprintf(dtitle,sizeof(dtitle),"%s %s %d",
1148- msg_hmth_du,l_month[cur_month-1],cur_year);
1149+ msg_hmth_du,Q_(l_month[cur_month-1]),cur_year);
1150 month_graph6 ( png1_fname, /* filename */
1151 dtitle, /* graph title */
1152 cur_month, /* graph month */
1153@@ -319,7 +319,7 @@
1154 if (hourly_graph)
1155 {
1156 snprintf(htitle,sizeof(htitle),"%s %s %d",
1157- msg_hmth_hu,l_month[cur_month-1],cur_year);
1158+ msg_hmth_hu,Q_(l_month[cur_month-1]),cur_year);
1159 day_graph3( png2_fname,
1160 htitle,
1161 th_hit,
1162@@ -331,7 +331,7 @@
1163 /* first, open the file */
1164 if ( (out_fp=open_out_file(html_fname))==NULL ) return 1;
1165
1166- snprintf(buffer,sizeof(buffer),"%s %d",l_month[cur_month-1],cur_year);
1167+ snprintf(buffer,sizeof(buffer),"%s %d",Q_(l_month[cur_month-1]),cur_year);
1168 write_html_head(buffer, out_fp);
1169 month_links();
1170 month_total_table();
1171@@ -529,7 +529,7 @@
1172 fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1173 fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1174 fprintf(out_fp,"<TR><TH COLSPAN=3 ALIGN=center BGCOLOR=\"%s\">" \
1175- "%s %s %d</TH></TR>\n",GREY,msg_mtot_ms,l_month[cur_month-1],cur_year);
1176+ "%s %s %d</TH></TR>\n",GREY,msg_mtot_ms,Q_(l_month[cur_month-1]),cur_year);
1177 fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1178 /* Total Hits */
1179 fprintf(out_fp,"<TR><TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
1180@@ -694,7 +694,7 @@
1181 /* Daily statistics for ... */
1182 fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" COLSPAN=%d ALIGN=center>" \
1183 "%s %s %d</TH></TR>\n",
1184- GREY,(dump_inout==0)?13:17,msg_dtot_ds,l_month[cur_month-1], cur_year);
1185+ GREY,(dump_inout==0)?13:17,msg_dtot_ds,Q_(l_month[cur_month-1]), cur_year);
1186 fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1187 fprintf(out_fp,"<TR><TH ALIGN=center BGCOLOR=\"%s\">" \
1188 "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
1189@@ -807,7 +807,7 @@
1190 fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1191 fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" COLSPAN=%d ALIGN=center>"\
1192 "%s %s %d</TH></TR>\n",
1193- GREY,(dump_inout==0)?13:19,msg_htot_hs,l_month[cur_month-1], cur_year);
1194+ GREY,(dump_inout==0)?13:19,msg_htot_hs,Q_(l_month[cur_month-1]), cur_year);
1195 fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1196 fprintf(out_fp,"<TR><TH ALIGN=center ROWSPAN=2 BGCOLOR=\"%s\">" \
1197 "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
1198@@ -1085,7 +1085,7 @@
1199 if ( (out_fp=open_out_file(site_fname))==NULL ) return 0;
1200
1201 snprintf(buffer,sizeof(buffer),"%s %d - %s",
1202- l_month[cur_month-1],cur_year,msg_h_sites);
1203+ Q_(l_month[cur_month-1]),cur_year,msg_h_sites);
1204 write_html_head(buffer, out_fp);
1205
1206 fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1207@@ -1344,7 +1344,7 @@
1208 if ( (out_fp=open_out_file(url_fname))==NULL ) return 0;
1209
1210 snprintf(buffer,sizeof(buffer),"%s %d - %s",
1211- l_month[cur_month-1],cur_year,msg_h_url);
1212+ Q_(l_month[cur_month-1]),cur_year,msg_h_url);
1213 write_html_head(buffer, out_fp);
1214
1215 fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1216@@ -1644,7 +1644,7 @@
1217 if ( (out_fp=open_out_file(ref_fname))==NULL ) return 0;
1218
1219 snprintf(buffer,sizeof(buffer),"%s %d - %s",
1220- l_month[cur_month-1],cur_year,msg_h_ref);
1221+ Q_(l_month[cur_month-1]),cur_year,msg_h_ref);
1222 write_html_head(buffer, out_fp);
1223
1224 fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1225@@ -1798,7 +1798,7 @@
1226 if ( (out_fp=open_out_file(agent_fname))==NULL ) return 0;
1227
1228 snprintf(buffer,sizeof(buffer),"%s %d - %s",
1229- l_month[cur_month-1],cur_year,msg_h_agent);
1230+ Q_(l_month[cur_month-1]),cur_year,msg_h_agent);
1231 write_html_head(buffer, out_fp);
1232
1233 fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1234@@ -1934,7 +1934,7 @@
1235 if ( (out_fp=open_out_file(search_fname))==NULL ) return 0;
1236
1237 snprintf(buffer,sizeof(buffer),"%s %d - %s",
1238- l_month[cur_month-1],cur_year,msg_h_search);
1239+ Q_(l_month[cur_month-1]),cur_year,msg_h_search);
1240 write_html_head(buffer, out_fp);
1241
1242 fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1243@@ -2098,7 +2098,7 @@
1244 if ( (out_fp=open_out_file(user_fname))==NULL ) return 0;
1245
1246 snprintf(buffer,sizeof(buffer),"%s %d - %s",
1247- l_month[cur_month-1],cur_year,msg_h_uname);
1248+ Q_(l_month[cur_month-1]),cur_year,msg_h_uname);
1249 write_html_head(buffer, out_fp);
1250
1251 fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1252@@ -2226,7 +2226,7 @@
1253 if (geo_ctry[0]=='-')
1254 {
1255 if (debug_mode)
1256- fprintf(stderr,"GeoDB: %s unknown!\n",hptr->string);
1257+ fprintf(stderr,_("GeoDB: %s unknown!\n"),hptr->string);
1258 }
1259 else idx=ctry_idx(geo_ctry);
1260 }
1261@@ -2239,7 +2239,7 @@
1262 if (geo_rc==NULL||geo_rc[0]=='\0'||geo_rc[0]=='-')
1263 {
1264 if (debug_mode)
1265- fprintf(stderr,"GeoIP: %s unknown (returns '%s')\n",
1266+ fprintf(stderr,_("GeoIP: %s unknown (returns '%s')\n"),
1267 hptr->string,(geo_rc==NULL)?"null":geo_rc);
1268 }
1269 else
1270@@ -2321,10 +2321,10 @@
1271 for (i=0;i<j;i++)
1272 {
1273 pie_data[i]=top_ctrys[i]->count; /* load the array */
1274- pie_legend[i]=top_ctrys[i]->desc;
1275+ pie_legend[i]=_(top_ctrys[i]->desc);
1276 }
1277 snprintf(pie_title,sizeof(pie_title),"%s %s %d",
1278- msg_ctry_use,l_month[cur_month-1],cur_year);
1279+ msg_ctry_use,Q_(l_month[cur_month-1]),cur_year);
1280 sprintf(pie_fname,"ctry_usage_%04d%02d.png",cur_year,cur_month);
1281
1282 pie_chart(pie_fname,pie_title,t_hit,pie_data,pie_legend); /* do it */
1283@@ -2741,7 +2741,7 @@
1284 else
1285 {
1286 if (errno!=EEXIST && verbose)
1287- fprintf(stderr,"Error: Failed to create .htaccess file: %s\n",
1288+ fprintf(stderr,_("Error: Failed to create .htaccess file: %s\n"),
1289 strerror(errno));
1290 }
1291 }
1292@@ -2849,10 +2849,10 @@
1293 fprintf(out_fp,"<A HREF=\"usage_%04d%02d.%s\">" \
1294 "<FONT SIZE=\"-1\">%s %d</FONT></A></TD>\n",
1295 hist[i].year, hist[i].month, html_ext,
1296- s_month[hist[i].month-1], hist[i].year);
1297+ Q_(s_month[hist[i].month-1]), hist[i].year);
1298 else
1299 fprintf(out_fp,"<FONT SIZE=\"-1\">%s %d</FONT></A></TD>\n", \
1300- s_month[hist[i].month-1], hist[i].year);
1301+ Q_(s_month[hist[i].month-1]), hist[i].year);
1302
1303 fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
1304 hist[i].hit/days_in_month);
1305Index: webalizer/update_po.sh
1306===================================================================
1307--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1308+++ webalizer/update_po.sh 2011-01-07 19:13:13.000000000 +0100
1309@@ -0,0 +1,9 @@
1310+# 7. Created webalizer.pot file with the follow command:
1311+ xgettext --default-domain=webalizer --directory=. -o po/webalizer.pot \
1312+ --language=C --add-comments="TRANS:" --escape --sort-by-file \
1313+ --keyword=_ --keyword=N_ --keyword=Q_ --keyword=PL_:1,2 *.c *.h
1314+# 8. Merged old .po files.
1315+ for i in po/*.po;do echo -n $i;msgmerge -U $i po/webalizer.pot;done;
1316+ rm -f po/*.po~;
1317+
1318+
1319Index: webalizer/webalizer.c
1320===================================================================
1321--- webalizer.orig/webalizer.c 2011-01-07 19:12:51.000000000 +0100
1322+++ webalizer/webalizer.c 2011-01-07 19:13:13.000000000 +0100
1323@@ -86,7 +86,7 @@
1324 #include "preserve.h"
1325 #include "hashtab.h"
1326 #include "linklist.h"
1327-#include "webalizer_lang.h" /* lang. support */
1328+#include "lang2.h" /* lang. support */
1329 #ifdef USE_DNS
1330 #include "dns_resolv.h"
1331 #endif
1332@@ -96,7 +96,7 @@
1333 void clear_month(); /* clear monthly stuff */
1334 char *unescape(char *); /* unescape URLs */
1335 void print_opts(char *); /* print options */
1336-void print_version(); /* duhh... */
1337+void print_version(char * locale); /* duhh... */
1338 int isurlchar(unsigned char, int); /* valid URL char fnc. */
1339 void get_config(char *); /* Read a config file */
1340 static char *save_opt(char *); /* save conf option */
1341@@ -299,6 +299,7 @@
1342
1343 time_t start_time, end_time; /* program timers */
1344 float temp_time; /* temporary time storage */
1345+ char *current_locale;
1346
1347 int rec_year,rec_month=1,rec_day,rec_hour,rec_min,rec_sec;
1348
1349@@ -317,10 +318,16 @@
1350
1351 /* stat struct for files */
1352 struct stat log_stat;
1353+ current_locale = setlocale (LC_ALL, "");
1354+ bindtextdomain ("webalizer", DATADIR"/locale");
1355+ textdomain ("webalizer");
1356
1357 /* Assume that LC_CTYPE is what the user wants for non-ASCII chars */
1358 setlocale(LC_CTYPE,"");
1359
1360+ /* Initialise report_title with the default localized value */
1361+ report_title = msg_title;
1362+
1363 /* initalize epoch */
1364 epoch=jdate(1,1,1970); /* used for timestamp adj. */
1365
1366@@ -377,12 +384,12 @@
1367 case 'R': ntop_refs=atoi(optarg); break; /* Top referrers */
1368 case 's': add_nlist(optarg,&hidden_sites); break; /* Hide site */
1369 case 'S': ntop_sites=atoi(optarg); break; /* Top sites */
1370- case 't': msg_title=optarg; break; /* Report title */
1371+ case 't': report_title=optarg; break; /* Report title */
1372 case 'T': time_me=1; break; /* TimeMe */
1373 case 'u': add_nlist(optarg,&hidden_urls); break; /* hide URL */
1374 case 'U': ntop_urls=atoi(optarg); break; /* Top urls */
1375 case 'v': verbose=2; debug_mode=1; break; /* Verbose */
1376- case 'V': print_version(); break; /* Version */
1377+ case 'V': print_version(current_locale); break; /* Version */
1378 #ifdef USE_GEOIP
1379 case 'w': geoip=1; break; /* Enable GeoIP */
1380 case 'W': geoip_db=optarg; break; /* GeoIP database name */
1381@@ -482,9 +489,9 @@
1382 if (verbose>1)
1383 {
1384 uname(&system_info);
1385- printf("Webalizer V%s-%s (%s %s %s) %s\n", version,editlvl,
1386+ printf("Webalizer V%s-%s (%s %s %s) %s: %s\n", version,editlvl,
1387 system_info.sysname, system_info.release,
1388- system_info.machine,language);
1389+ system_info.machine, _("locale"), current_locale);
1390 }
1391
1392 #ifndef USE_DNS
1393@@ -697,7 +704,7 @@
1394 total_rec++;
1395 if (strlen(buffer) == (BUFSIZE-1))
1396 {
1397- if (verbose)
1398+ if (verbose>1)
1399 {
1400 fprintf(stderr,"%s",msg_big_rec);
1401 if (debug_mode) fprintf(stderr,":\n%s",buffer);
1402@@ -1728,7 +1735,7 @@
1403 {
1404 case 1: out_dir=save_opt(value); break; /* OutputDir */
1405 case 2: log_fname=save_opt(value); break; /* LogFile */
1406- case 3: msg_title=save_opt(value); break; /* ReportTitle */
1407+ case 3: report_title=save_opt(value); break; /* ReportTitle */
1408 case 4: hname=save_opt(value); break; /* HostName */
1409 case 5: ignore_hist=
1410 (tolower(value[0])=='y')?1:0; break; /* IgnoreHist */
1411@@ -1989,7 +1996,7 @@
1412 int i;
1413
1414 printf("%s: %s %s\n",h_usage1,pname,h_usage2);
1415- for (i=0;h_msg[i];i++) printf("%s\n",h_msg[i]);
1416+ for (i=0;h_msg[i];i++) printf("%s\n",_(h_msg[i]));
1417 exit(1);
1418 }
1419
1420@@ -1997,7 +2004,7 @@
1421 /* PRINT_VERSION */
1422 /*********************************************/
1423
1424-void print_version()
1425+void print_version(char *locale)
1426 {
1427 char buf[128]="";
1428 uname(&system_info);
1429@@ -2005,7 +2012,7 @@
1430 printf("Webalizer V%s-%s (%s %s %s) %s\n%s\n",
1431 version,editlvl,
1432 system_info.sysname,system_info.release,system_info.machine,
1433- language,copyright);
1434+ _("locale"),copyright);
1435
1436 #ifdef USE_DNS
1437 strncpy(&buf[strlen(buf)],"DNS/GeoDB ",11);
1438@@ -2024,9 +2031,9 @@
1439 else printf("none");
1440 printf("\n");
1441 #if USE_DNS
1442- printf("Default GeoDB dir : %s\n",GEODB_LOC);
1443+ printf(_("Default GeoDB dir : %s\n"),GEODB_LOC);
1444 #endif
1445- printf("Default config dir: %s\n",ETCDIR);
1446+ printf(_("Default config dir: %s\n"),ETCDIR);
1447 printf("\n");
1448 }
1449 else printf("\n");
1450@@ -2532,3 +2539,33 @@
1451
1452 return(days+5);
1453 }
1454+
1455+/*****************************************************************/
1456+/* */
1457+/* intl_strip_context - Strip Context in gettext */
1458+/* */
1459+/* Strip "|" string from a string that will be translated */
1460+/* */
1461+/* Originally copied from gettext info page. */
1462+/* Returns a translated string witout nothing before the first */
1463+/* "|" character. */
1464+/* */
1465+/* Usage: string = intl_strip_context(string) */
1466+/* Or: string = Q_(string) */
1467+/* */
1468+/* This function is useful to help translation of strings like */
1469+/* month "May" that its forms is equal in Short and Long */
1470+/*****************************************************************/
1471+
1472+char *intl_strip_context (const char *msgid)
1473+{
1474+ char *msgval = gettext (msgid);
1475+ char *pipe;
1476+
1477+ pipe = strchr(msgval, '|');
1478+ if (pipe != NULL)
1479+ return (char*)(pipe + 1);
1480+
1481+ return (char*)msgval;
1482+}
1483+
1484Index: webalizer/webalizer.h
1485===================================================================
1486--- webalizer.orig/webalizer.h 2011-01-07 19:12:31.000000000 +0100
1487+++ webalizer/webalizer.h 2011-01-07 19:13:13.000000000 +0100
1488@@ -301,7 +301,7 @@
1489 extern char pie_color3[]; /* pie additionnal color 3 */
1490 extern char pie_color4[]; /* pie additionnal color 4 */
1491
1492-/* define our externally visable functions */
1493+/* define our externally visible functions */
1494
1495 extern char *cur_time();
1496 extern u_int64_t ctry_idx(char *);
1497@@ -311,5 +311,6 @@
1498 extern u_int64_t jdate(int,int,int);
1499 extern char from_hex(char);
1500 extern int isipaddr(char *);
1501+extern char *intl_strip_context();
1502
1503 #endif /* _WEBALIZER_H */