]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Propose more messages for translation
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Fri, 5 Mar 2010 20:49:01 +0000 (20:49 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Fri, 5 Mar 2010 20:49:01 +0000 (20:49 +0000)
getconf.c
log.c

index 9da80f5baef6874cfddf8b522dce32894f104a12..455dd39e9866a67345a4f000367a747e27b33f4e 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -146,7 +146,7 @@ static int getparam_string(const char *param,char *buf,char *value,int value_siz
    while (*buf && (unsigned char)*buf<=' ') buf++;
 
    if (strlen(buf)>=value_size) {
-      printf("SARG: Maybe you have a broken record or garbage in %s parameter.\n",param);
+      debuga(_("The string value of parameter \"%s\" is too long"),param);
       exit(1);
    }
    strcpy(value,buf);
@@ -166,7 +166,7 @@ static int getparam_quoted(const char *param,char *buf,char *value,int value_siz
    while (*buf && (unsigned char)*buf<=' ') buf++;
 
    if (*buf != '\"') {
-      printf("SARG: %s %s.\n",_("Missing double quote after parameter"),param);
+      debuga(_("Missing double quote after parameter \"%s\""),param);
       exit(1);
    }
    buf++;
@@ -178,7 +178,7 @@ static int getparam_quoted(const char *param,char *buf,char *value,int value_siz
    value[i]='\0';
 
    if (*buf != '\"') {
-      printf("SARG: Missing double quote after parameter %s or value is more than %d bytes long.\n",param,value_size);
+      debuga(_("Missing double quote after parameter \"%s\" or value is more than %d bytes long"),param,value_size);
       exit(1);
    }
    fixnone(value);
@@ -199,11 +199,11 @@ static int getparam_2words(const char *param,char *buf,char *word1,int word1_siz
    for (i=0 ; i<word1_size && *buf && (unsigned char)*buf>' ' ; i++)
       word1[i]=*buf++;
    if (i>=word1_size) {
-      printf("SARG: The first word of parameter %s is more than %d bytes long.\n",param,word1_size-1);
+      debuga(_("The first word of parameter \"%s\" is more than %d bytes long"),param,word1_size-1);
       exit(1);
    }
    if (*buf!=' ') {
-      printf("SARG: Missing second word for parameter %s.\n",param);
+      debuga(_("Missing second word for parameter \"%s\""),param);
       exit(1);
    }
    word1[i]=0;
@@ -213,7 +213,7 @@ static int getparam_2words(const char *param,char *buf,char *word1,int word1_siz
    for (i=0 ; i<word2_size && *buf && (unsigned char)*buf>' ' ; i++)
       word2[i]=*buf++;
    if (i>=word2_size) {
-      printf("SARG: The second word of parameter %s is more than %d bytes long.\n",param,word2_size-1);
+      debuga(_("The second word of parameter \"%s\" is more than %d bytes long"),param,word2_size-1);
       exit(1);
    }
    word2[i]=0;
@@ -236,7 +236,7 @@ static int getparam_int(const char *param,char *buf,int *value)
 
    next=0;
    if (sscanf(buf,"%d%n",value,&next) != 1 || (unsigned char)buf[next] > ' ') {
-      printf("SARG: Maybe you have a broken record or garbage in %s parameter.\n",param);
+      debuga(_("The integer value of parameter \"%s\" is invalid"),param);
       exit(1);
    }
    return(1);
@@ -288,11 +288,11 @@ static int getparam_list(const char *param,struct param_list *options,int noptio
       }
       for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
       if (i>=noptions) {
-         fprintf(stderr,"SARG: Unknown value %s for parameter %s\n",buf,param);
+         debuga(_("SUnknown value \"%s\" for parameter \"%s\""),buf,param);
          exit(1);
       }
       if ((*value & options[i].exclude)!=0) {
-         fprintf(stderr,"SARG: Value %s conflicts with other selected values of parameter %s\n",buf,param);
+         debuga(_("Value \"%s\" conflicts with other selected values for parameter \"%s\""),buf,param);
          exit(1);
       }
       *value|=options[i].value;
@@ -312,7 +312,7 @@ static void parmtest(char *buf)
       return;
 
    if(debugz)
-      printf("SARG: TAG: %s\n",buf);
+      printf(_("SARG: TAG: %s\n"),buf);
 
    if (getparam_string("background_color",buf,BgColor,sizeof(BgColor))>0) return;
 
@@ -359,7 +359,7 @@ static void parmtest(char *buf)
    if (is_param("date_format",buf)) {
       getword_start(&gwarea,buf);
       if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in date_format parameter.\n");
+         debuga(_("Maybe you have a broken record or garbage in \"date_format\" parameter"));
          exit(1);
       }
       strncpy(DateFormat,gwarea.current,1);
@@ -369,14 +369,14 @@ static void parmtest(char *buf)
 
    if (is_param("hours",buf)) {
       if( getnumlist( buf, &hours, 24, 24 ) ) {
-         fprintf( stderr, "Error: Invalid syntax in hours tag!\n" );
+         debuga(_("Error: Invalid syntax in hours tag!"));
          exit( 1 );
       }
    }
 
    if (is_param("weekdays",buf)) {
       if( getnumlist( buf, &weekdays, 7, 7 ) ) {
-         fprintf( stderr, "Error: Invalid syntax in weekdays tag!\n" );
+         debuga(_("Error: Invalid syntax in weekdays tag!"));
          exit( 1 );
       }
    }
@@ -388,7 +388,7 @@ static void parmtest(char *buf)
    if (is_param("access_log",buf)>0) {
       if (AccessLogFromCmdLine==0) {
          if (NAccessLog>=MAXLOGS) {
-            fprintf(stderr,"SARG: Too many log files.\n");
+            debuga(_("Too many log files in configuration file"));
             exit(1);
          }
          getparam_string("access_log",buf,AccessLog[NAccessLog],MAXLEN);
@@ -587,19 +587,19 @@ static void parmtest(char *buf)
    if(strstr(buf,"byte_cost") != 0) {
       getword_start(&gwarea,buf);
       if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
+         debuga(_("The \"byte_cost\" parameter of the configuration file is invalid"));
          exit(1);
       }
       cost=atol(gwarea.current);
       if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
+         debuga(_("The \"byte_cost\" parameter of the configuration file is invalid"));
          exit(1);
       }
       nocost=my_atoll(gwarea.current);
       return;
    }
 
-   printf("SARG: %s %s\n",_("Unknown option"),buf);
+   printf(_("SARG: Unknown option %s\n"),buf);
 }
 
 void getconf(void)
@@ -609,10 +609,10 @@ void getconf(void)
    char buf[MAXLEN];
 
    if(debug)
-      debuga("Loading configuration from: %s",ConfigFile);
+      debuga(_("Loading configuration from: %s"),ConfigFile);
 
    if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
-      fprintf(stderr, "SARG: (getconf) Cannot open file: %s\n",ConfigFile);
+      debuga(_("SARG: (getconf) Cannot open file: %s"),ConfigFile);
       exit(1);
    }
 
diff --git a/log.c b/log.c
index 365bf83a3fc8cb229deb965d93ced86f7bed8c82..7357e09429223985b8ec5cf1394d892356dda149 100644 (file)
--- a/log.c
+++ b/log.c
@@ -356,7 +356,7 @@ int main(int argc,char *argv[])
             date[sizeof(date)-1]='\0';
             getword_start(&gwarea,optarg);
             if (getword(cdfrom,sizeof(cdfrom),&gwarea,'-')<0 || getword(cduntil,sizeof(cduntil),&gwarea,0)<0) {
-               printf("SARG: Maybe you have a broken record or garbage in your date range.\n");
+               printf(_("SARG: The date range requested on the command line by option -d is invalid.\n"));
                exit(1);
             }
             date_from(date, cdfrom, cduntil);
@@ -381,7 +381,7 @@ int main(int argc,char *argv[])
             break;
          case 'l':
             if (NAccessLog>=MAXLOGS) {
-               printf("SARG: Too many log files.\n");
+               printf(_("SARG: Too many log files passed on command line with option -l.\n"));
                exit(1);
             }
             strcpy(AccessLog[NAccessLog],optarg);
@@ -419,17 +419,17 @@ int main(int argc,char *argv[])
             } else {
                getword_start(&gwarea,optarg);
                if (getword(hm,sizeof(hm),&gwarea,'-')<0 || getword(hmf,sizeof(hmf),&gwarea,0)<0) {
-                  fprintf(stderr,"SARG: Maybe you have a broken record or garbage in your time range.\n");
+                  debuga(_("The time range passed on the command line with option -t is invalid"));
                   exit(1);
                }
             }
             if(sscanf(hm,"%d:%d",&h,&m)!=2) {
-               fprintf(stderr,"SARG: time period must be MM or MM:SS. Exit.\n");
+               debuga(_("Time period must be MM or MM:SS. Exit"));
                exit(1);
             }
             sprintf(hm,"%02d%02d",h,m);
             if(sscanf(hmf,"%d:%d",&h,&m)!=2) {
-               fprintf(stderr,"SARG: time period must be MM or MM:SS. Exit.\n");
+               debuga(_("Time period must be MM or MM:SS. Exit"));
                exit(1);
             }
             sprintf(hmf,"%02d%02d",h,m);
@@ -454,7 +454,7 @@ int main(int argc,char *argv[])
             debugz++;
             break;
          case ':':
-            fprintf(stderr, "Option -%c require an argument\n",optopt);
+            debuga(_("Option -%c require an argument"),optopt);
             errflg++;
             break;
          case '?':
@@ -592,95 +592,65 @@ int main(int argc,char *argv[])
    strcat(tmp6,"/authfail.log.unsort");
 
    if(debug) {
-      fprintf(stderr, "SARG: %s:\nSARG:\n",_("Parameters"));
-      fprintf(stderr, "SARG: %35s (-a) = %s\n",_("Hostname or IP address"),addr);
-      fprintf(stderr, "SARG: %35s (-b) = %s\n",_("Useragent log"),uagent);
-      fprintf(stderr, "SARG: %35s (-c) = %s\n",_("Exclude file"),hexclude);
-      fprintf(stderr, "SARG: %35s (-d) = %s\n",_("Date from-until"),date);
-      fprintf(stderr, "SARG: %35s (-e) = %s\n",_("Email address to send reports"),email);
-      fprintf(stderr, "SARG: %35s (-f) = %s\n",_("Config file"),ConfigFile);
+      fprintf(stderr, _("SARG: Parameters:\nSARG:\n"));
+      fprintf(stderr, _("SARG:           Hostname or IP address (-a) = %s\n"),addr);
+      fprintf(stderr, _("SARG:                    Useragent log (-b) = %s\n"),uagent);
+      fprintf(stderr, _("SARG:                     Exclude file (-c) = %s\n"),hexclude);
+      fprintf(stderr, _("SARG:                  Date from-until (-d) = %s\n"),date);
+      fprintf(stderr, _("SARG:    Email address to send reports (-e) = %s\n"),email);
+      fprintf(stderr, _("SARG:                      Config file (-f) = %s\n"),ConfigFile);
       if(strcmp(df,"e") == 0)
-         fprintf(stderr, "SARG: %35s (-g) = %s (dd/mm/yyyy)\n",_("Date format"),_("Europe"));
+         fprintf(stderr, _("SARG:                      Date format (-g) = Europe (dd/mm/yyyy)\n"));
       if(strcmp(df,"u") == 0)
-         fprintf(stderr, "SARG: %35s (-g) = %s (mm/dd/yyyy)\n",_("Date format"),_("USA"));
+         fprintf(stderr, _("SARG:                      Date format (-g) = USA (mm/dd/yyyy)\n"));
       if(strcmp(df,"w") == 0)
-         fprintf(stderr, "SARG: %35s (-g) = %s (yyyy/ww)\n",_("Date format"),_("Sites & Users"));
-      if(iprel)
-         fprintf(stderr, "SARG: %35s (-i) = %s\n",_("IP report"),_("Yes"));
-      else
-         fprintf(stderr, "SARG: %35s (-i) = %s\n",_("IP report"),_("No"));
+         fprintf(stderr, _("SARG:                      Date format (-g) = Sites & Users (yyyy/ww)\n"));
+      fprintf(stderr, _("SARG:                        IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
       for (iarq=0 ; iarq<NAccessLog ; iarq++)
-         fprintf(stderr, "SARG: %35s (-l) = %s\n",_("Input log"),AccessLog[iarq]);
-      if(Ip2Name)
-         fprintf(stderr, "SARG: %35s (-n) = %s\n",_("Resolve IP Address"),_("Yes"));
-       else
-         fprintf(stderr, "SARG: %35s (-n) = %s\n",_("Resolve IP Address"),_("No"));
-      fprintf(stderr, "SARG: %35s (-o) = %s\n",_("Output dir"),outdir);
-      if(UserIp)
-         fprintf(stderr, "SARG: %35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("Yes"));
-       else
-         fprintf(stderr, "SARG: %35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("No"));
-      fprintf(stderr, "SARG: %35s (-s) = %s\n",_("Accessed site"),site);
-      fprintf(stderr, "SARG: %35s (-t) = %s\n",_("Time"),hm);
-      fprintf(stderr, "SARG: %35s (-u) = %s\n",_("User"),us);
-      fprintf(stderr, "SARG: %35s (-w) = %s\n",_("Temporary dir"),tmp);
-      if(debug)
-         fprintf(stderr, "SARG: %35s (-x) = %s\n",_("Debug messages"),_("Yes"));
-       else
-         fprintf(stderr, "SARG: %35s (-x) = %s\n",_("Debug messages"),_("No"));
-      if(debugz)
-         fprintf(stderr, "SARG: %35s (-z) = %s\n",_("Process messages"),_("Yes"));
-       else
-         fprintf(stderr, "SARG: %35s (-z) = %s\n",_("Process messages"),_("No"));
-      fprintf(stderr, "SARG:\n");
+         fprintf(stderr, _("SARG:                        Input log (-l) = %s\n"),AccessLog[iarq]);
+      fprintf(stderr, _("SARG:               Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
+      fprintf(stderr, _("SARG:                       Output dir (-o) = %s\n"),outdir);
+      fprintf(stderr, _("SARG: Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
+      fprintf(stderr, _("SARG:                    Accessed site (-s) = %s\n"),site);
+      fprintf(stderr, _("SARG:                             Time (-t) = %s\n"),hm);
+      fprintf(stderr, _("SARG:                             User (-u) = %s\n"),us);
+      fprintf(stderr, _("SARG:                    Temporary dir (-w) = %s\n"),tmp);
+      fprintf(stderr, _("SARG:                   Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
+      fprintf(stderr, _("SARG:                 Process messages (-z) = %s\n"),(debugz) ? _("Yes") : _("No"));
+      fprintf(stderr, _("SARG:\n"));
    }
 
    if(debugm) {
-      printf("%s:\nSARG:\n",_("Parameters"));
-      printf("%35s (-a) = %s\n",_("Hostname or IP address"),addr);
-      printf("%35s (-b) = %s\n",_("Useragent log"),uagent);
-      printf("%35s (-c) = %s\n",_("Exclude file"),hexclude);
-      printf("%35s (-d) = %s\n",_("Date from-until"),date);
-      printf("%35s (-e) = %s\n",_("Email address to send reports"),email);
-      printf("%35s (-f) = %s\n",_("Config file"),ConfigFile);
+      printf(_("Parameters:\n"));
+      printf(_("          Hostname or IP address (-a) = %s\n"),addr);
+      printf(_("                   Useragent log (-b) = %s\n"),uagent);
+      printf(_("                    Exclude file (-c) = %s\n"),hexclude);
+      printf(_("                 Date from-until (-d) = %s\n"),date);
+      printf(_("   Email address to send reports (-e) = %s\n"),email);
+      printf(_("                     Config file (-f) = %s\n"),ConfigFile);
       if(strcmp(df,"e") == 0)
-         printf("%35s (-g) = %s (dd/mm/yyyy)\n",_("Date format"),_("Europe"));
+         printf(_("                     Date format (-g) = Europe (dd/mm/yyyy)\n"));
       if(strcmp(df,"u") == 0)
-         printf("%35s (-g) = %s (mm/dd/yyyy)\n",_("Date format"),_("USA"));
+         printf(_("                     Date format (-g) = USA (mm/dd/yyyy)\n"));
       if(strcmp(df,"w") == 0)
-         printf("%35s (-g) = %s (yyyy/ww)\n",_("Date format"),_("Sites & Users"));
-      if(iprel)
-         printf("%35s (-i) = %s\n",_("IP report"),_("Yes"));
-      else
-         printf("%35s (-i) = %s\n",_("IP report"),_("No"));
+         printf(_("                     Date format (-g) = Sites & Users (yyyy/ww)\n"));
+      printf(_("                       IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
       for (iarq=0 ; iarq<NAccessLog ; iarq++)
-         printf("%35s (-l) = %s\n",_("Input log"),AccessLog[iarq]);
-      if(Ip2Name)
-         printf("%35s (-n) = %s\n",_("Resolve IP Address"),_("Yes"));
-       else
-         printf("%35s (-n) = %s\n",_("Resolve IP Address"),_("No"));
-      printf("%35s (-o) = %s\n",_("Output dir"),outdir);
-      if(UserIp)
-         printf("%35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("Yes"));
-       else
-         printf("%35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("No"));
-      printf("%35s (-s) = %s\n",_("Accessed site"),site);
-      printf("%35s (-t) = %s\n",_("Time"),hm);
-      printf("%35s (-u) = %s\n",_("User"),us);
-      printf("%35s (-w) = %s\n",_("Temporary dir"),tmp);
-      if(debug)
-         printf("%35s (-x) = %s\n",_("Debug messages"),_("Yes"));
-       else
-         printf("%35s (-x) = %s\n",_("Debug messages"),_("No"));
-      if(debugz)
-         printf("%35s (-z) = %s\n",_("Process messages"),_("Yes"));
-       else
-         printf("%35s (-z) = %s\n",_("Process messages"),_("No"));
-      printf("sarg %s: %s\n",_("version"),VERSION);
+         printf(_("                       Input log (-l) = %s\n"),AccessLog[iarq]);
+      printf(_("              Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
+      printf(_("                      Output dir (-o) = %s\n"),outdir);
+      printf(_("Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
+      printf(_("                   Accessed site (-s) = %s\n"),site);
+      printf(_("                            Time (-t) = %s\n"),hm);
+      printf(_("                            User (-u) = %s\n"),us);
+      printf(_("                   Temporary dir (-w) = %s\n"),tmp);
+      printf(_("                  Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
+      printf(_("                Process messages (-z) = %s\n"),(debugz) ? _("Yes") : _("No"));
+      printf(_("sarg version: %s\n"),VERSION);
    }
 
    if(debug)
-      debuga("sarg %s: %s",_("version"),VERSION);
+      debuga(_("sarg version: %s"),VERSION);
 
    maxopenfiles=MAX_OPEN_USER_FILES;
 #ifdef HAVE_RLIM_T
@@ -728,7 +698,7 @@ int main(int argc,char *argv[])
 
    if((ReportType & REPORT_TYPE_DENIED) != 0) {
       if((fp_denied=MY_FOPEN(tmp4,"w"))==NULL) {
-         fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open file"),tmp4,strerror(errno));
+         debuga(_("SARG: (log) Cannot open file: %s - %s"),tmp4,strerror(errno));
          exit(1);
       }
    }
@@ -736,7 +706,7 @@ int main(int argc,char *argv[])
    if(DataFile[0]=='\0') {
       if((ReportType & REPORT_TYPE_DENIED) != 0 || (ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) {
          if((fp_authfail=MY_FOPEN(tmp6,"w"))==NULL) {
-            fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open file"),tmp6,strerror(errno));
+            debuga(_("SARG: (log) Cannot open file: %s - %s"),tmp6,strerror(errno));
             exit(1);
          }
       }
@@ -749,15 +719,15 @@ int main(int argc,char *argv[])
 
       if(strcmp(arq,"-")==0) {
          if(debug)
-            debuga("%s: %s",_("Reading access log file"),"stdin");
+            debuga(_("Reading access log file: from stdin"));
          fp_in=stdin;
          from_stdin=1;
       } else {
          decomp(arq,zip,tmp);
          if(debug)
-            debuga("%s: %s",_("Reading access log file"),arq);
+            debuga(_("Reading access log file: %s"),arq);
          if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
-            fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open log file"),arq,strerror(errno));
+            debuga(_("SARG: (log) Cannot open log file: %s - %s"),arq,strerror(errno));
             exit(1);
          }
          from_stdin=0;
@@ -786,7 +756,7 @@ int main(int argc,char *argv[])
                }
          }
          rewind(fp_in);
-         printf("SARG: Records in file: %lu, reading: %3.2f%%\r",recs1,(float) 0);
+         printf(_("SARG: Records in file: %lu, reading: %3.2f%%\r"),recs1,(float) 0);
          fflush( stdout ) ;
       }
 
@@ -801,7 +771,7 @@ int main(int argc,char *argv[])
             if(strncmp(linebuf,"#Software: Mic",14) == 0) {
                fixendofline(linebuf);
                if (debug)
-                  debuga("%s: %s",_("Log is from Microsoft ISA"),linebuf);
+                  debuga(_("Log is from Microsoft ISA: %s"),linebuf);
                ilf=ILF_Isa;
                ilf_count[ilf]++;
                continue;
@@ -827,7 +797,7 @@ int main(int argc,char *argv[])
             }
             sprintf(arq_log,"%s/sarg_temp.log",ParsedOutputLog);
             if((fp_log=MY_FOPEN(arq_log,"w"))==NULL) {
-               fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open log file"),arq_log,strerror(errno));
+               debuga(_("SARG: (log) Cannot open log file: %s - %s"),arq_log,strerror(errno));
                exit(1);
             }
             fputs("*** SARG Log ***\n",fp_log);