]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Translatable "generated by" message
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Mon, 22 Dec 2014 13:00:43 +0000 (14:00 +0100)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Mon, 22 Dec 2014 13:00:43 +0000 (14:00 +0100)
The string telling the user what program produced the report and when was
not easy to translate because it was split in pieces.

smartfilter.c
util.c

index cea5751ca5b73454326d4025d90595ce9ac25385..a0eb8a4a02a4ddf3ba9302236766786f5bbf5f83 100644 (file)
@@ -33,6 +33,7 @@ void smartfilter_report(void)
 
        char buf[MAXLEN];
        char url[MAXLEN];
+       char pgmurl[250];
        char csort[255];
        char smart_in[MAXLEN];
        char smart_ou[MAXLEN];
@@ -114,6 +115,7 @@ void smartfilter_report(void)
        fputs("<tr><td></td></tr>\n",fp_ou);
        fputs("<tr><td></td></tr>\n",fp_ou);
        fprintf(fp_ou,"<tr><th bgcolor=%s><font size=\"%s\">%s</font></th><th bgcolor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\"%s\"><font size=\"%s\">%s</font></th></tr>\n",HeaderBgColor,FontSize,_("USERID"),HeaderBgColor,FontSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),HeaderBgColor,FontSize,_("ACCESSED SITE"),HeaderBgColor,FontSize,_("SMARTFILTER"));
+       snprintf(pgmurl,sizeof(pgmurl),"<a href=\"%s\">%s-%s</a>",URL,PGM,VERSION);
 
        while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
                getword_start(&gwarea,buf);
@@ -137,7 +139,12 @@ void smartfilter_report(void)
                                fputs("</table>\n",fp_user);
                                if(ShowSargInfo) {
                                        zdate(ftime, sizeof(ftime), DateFormat);
-                                       fprintf(fp_user,"<br><br><div align=\"center\"><font size=\"-2\">%s <a href=\"%s\">%s-%s</a> %s %s</font></div>\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime);
+                                       fputs("<br><br><div align=\"center\"><font size=\"-2\">",fp_user);
+                                       /* TRANSLATORS: The first %s is an html <a> tag with a link to the sarg
+                                        * website. The second %s is the report generation time.
+                                        */
+                                       fprintf(fp_user,_("Generated by %s on %s"),pgmurl,ftime);
+                                       fputs("</font></div>\n",fp_user);
                                }
                                fputs("</body>\n</html>\n",fp_user);
                                fclose(fp_user);
@@ -191,7 +198,9 @@ void smartfilter_report(void)
 
        if(ShowSargInfo) {
                zdate(ftime, sizeof(ftime), DateFormat);
-               fprintf(fp_ou,"<br><br><div align=\"center\"><font size=\"-2\">%s <a href=\"%s\">%s-%s</a> %s %s</font></div>\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime);
+               fputs("<br><br><div align=\"center\"><font size=\"-2\">",fp_ou);
+               fprintf(fp_ou,_("Generated by %s on %s"),pgmurl,ftime);
+               fputs("</font></div>\n",fp_ou);
        }
 
        fputs("</body>\n</html>\n",fp_user);
@@ -201,7 +210,9 @@ void smartfilter_report(void)
                fputs("</table>\n",fp_user);
                if(ShowSargInfo) {
                        zdate(ftime, sizeof(ftime), DateFormat);
-                       fprintf(fp_user,"<br><br><div align=\"center\"><font size=\"-2\">%s <a href=\"%s\">%s-%s</a> %s %s</font></div>\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime);
+                       fputs("<br><br><div align=\"center\"><font size=\"-2\">",fp_user);
+                       fprintf(fp_user,_("Generated by %s on %s"),pgmurl,ftime);
+                       fputs("</font></div>\n",fp_user);
                }
                fputs("</body>\n</html>\n",fp_user);
                fclose(fp_user);
diff --git a/util.c b/util.c
index fa502217dc7bb098f899c627b82c3a8b2142bb9b..0365c593c66cc2e444e323ed4bf86960ec398bb9 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1656,10 +1656,14 @@ char *get_size(const char *path, const char *file)
 void show_info(FILE *fp_ou)
 {
        char ftime[127];
+       char pgmurl[250];
 
        if(!ShowSargInfo) return;
        zdate(ftime, sizeof(ftime), DateFormat);
-       fprintf(fp_ou,"<div class=\"info\">%s <a href='%s'>%s-%s</a> %s %s</div>\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime);
+       fputs("<div class=\"info\">",fp_ou);
+       snprintf(pgmurl,sizeof(pgmurl),"<a href='%s'>%s-%s</a>",URL,PGM,VERSION);
+       fprintf(fp_ou,_("Generated by %s on %s"),pgmurl,ftime);
+       fputs("</div>\n",fp_ou);
 }
 
 void show_sarg(FILE *fp_ou, int depth)