From 3c5674231eb4df1eb2a2a1d1c2cd0f27c9bbe46c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Fri, 5 Mar 2010 20:49:01 +0000 Subject: [PATCH] Propose more messages for translation --- getconf.c | 38 +++++++------- log.c | 148 ++++++++++++++++++++++-------------------------------- 2 files changed, 78 insertions(+), 108 deletions(-) diff --git a/getconf.c b/getconf.c index 9da80f5..455dd39 100644 --- 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' ' ; 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' ' ; 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) { - 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 365bf83..7357e09 100644 --- 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