changeset 13619:a68dbf641f85

Translatable messages moved to help_mp-en.h. patch by The Wanderer <inverseparadox at comcast dot net>
author diego
date Tue, 12 Oct 2004 11:29:21 +0000
parents dd4222618f34
children db051195ad68
files codec-cfg.c help/help_mp-en.h
diffstat 2 files changed, 59 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Tue Oct 12 08:13:44 2004 +0000
+++ b/codec-cfg.c	Tue Oct 12 11:29:21 2004 +0000
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "mp_msg.h"
 
+#include "help_mp.h"
+
 // for mmioFOURCC:
 #include "libmpdemux/aviheader.h"
 
@@ -80,13 +82,13 @@
 		goto err_out_parse_error;
 	return 1;
 err_out_duplicated:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated FourCC");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_DuplicateFourcc);
 	return 0;
 err_out_too_many:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many FourCCs/formats...");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyFourccs);
 	return 0;
 err_out_parse_error:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError);
 	return 0;
 }
 
@@ -99,20 +101,20 @@
 	for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++)
 		/* NOTHING */;
 	if (i == CODECS_MAX_FOURCC) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many FourCCs/formats...");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyFourccs);
 		return 0;
 	}
 
         fourcc[i]=strtoul(s,&endptr,0);
 	if (*endptr != '\0') {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error (format ID not a number?)");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseErrorFIDNotNumber);
 		return 0;
 	}
 
 	if(alias){
 	    fourccmap[i]=strtoul(alias,&endptr,0);
 	    if (*endptr != '\0') {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error (format ID alias not a number?)");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseErrorFIDAliasNotNumber);
 		return 0;
 	    }
 	} else
@@ -120,7 +122,7 @@
 
 	for (j = 0; j < i; j++)
 		if (fourcc[j] == fourcc[i]) {
-			mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated format ID");
+			mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_DuplicateFID);
 			return 0;
 		}
 
@@ -232,10 +234,10 @@
         
 	return 1;
 err_out_too_many:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many out...");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyOut);
 	return 0;
 err_out_parse_error:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError);
 	return 0;
 }
 
@@ -318,7 +320,7 @@
 		/* NOTHING */;
 
 	if (i < strlen(tmp_name)) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) name is not valid!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_InvalidCodecName, c->name);
 		return 0;
 	}
 
@@ -327,13 +329,13 @@
 
 #if 0
 	if (c->fourcc[0] == 0xffffffff) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) does not have FourCC/format!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksFourcc, c->name);
 		return 0;
 	}
 
 	/* XXX fix this: shitty with 'null' codec */
 	if (!c->driver) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) does not have a driver!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksDriver, c->name);
 		return 0;
 	}
 #endif
@@ -343,7 +345,7 @@
 #warning HOL VANNAK DEFINIALVA????????????
 	if (!c->dll && (c->driver == 4 ||
 				(c->driver == 2 && type == TYPE_VIDEO))) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) needs a 'dll'!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsDLL, c->name);
 		return 0;
 	}
 #warning guid.f1 lehet 0? honnan lehet tudni, hogy nem adtak meg?
@@ -351,7 +353,7 @@
 
 	if (type == TYPE_VIDEO)
 		if (c->outfmt[0] == 0xffffffff) {
-			mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) needs an 'outfmt'!\n", c->name);
+			mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsOutfmt, c->name);
 			return 0;
 		}
 #endif
@@ -369,7 +371,7 @@
 		(*d)[pos++] = '\n';
 	}
 	if (!(*d = (char *) realloc(*d, pos + strlen(s) + 1))) {
-		mp_msg(MSGT_CODECCFG,MSGL_FATAL,"Can't allocate memory for comment. ");
+		mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantAllocateComment);
 		return 0;
 	}
 	strcpy(*d + pos, s);
@@ -418,7 +420,7 @@
 	char c;
 
 	if (max >= MAX_NR_TOKEN) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"get_token(): max >= MAX_NR_TOKEN!");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_GetTokenMaxNotLessThanMAX_NR_TOKEN);
 		goto out_eof;
 	}
 
@@ -506,15 +508,15 @@
 #endif
 	}
 	
-	mp_msg(MSGT_CODECCFG,MSGL_INFO,"Reading %s: ", cfgfile);
+	mp_msg(MSGT_CODECCFG,MSGL_INFO,MSGTR_ReadingFile, cfgfile);
 
 	if ((fp = fopen(cfgfile, "r")) == NULL) {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"Can't open '%s': %s\n", cfgfile, strerror(errno));
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantOpenFileError, cfgfile, strerror(errno));
 		return 0;
 	}
 
 	if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
-		mp_msg(MSGT_CODECCFG,MSGL_FATAL,"Can't get memory for 'line': %s\n", strerror(errno));
+		mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantGetMemoryForLine, strerror(errno));
 		return 0;
 	}
 	read_nextline = 1;
@@ -572,7 +574,7 @@
 			}
 		        if (!(*codecsp = (codecs_t *) realloc(*codecsp,
 				sizeof(codecs_t) * (*nr_codecsp + 2)))) {
-			    mp_msg(MSGT_CODECCFG,MSGL_FATAL,"Can't realloc '*codecsp': %s\n", strerror(errno));
+			    mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantReallocCodecsp, strerror(errno));
 			    goto err_out;
 		        }
 			codec=*codecsp + *nr_codecsp;
@@ -587,19 +589,19 @@
 			for (i = 0; i < *nr_codecsp - 1; i++) {
 				if(( (*codecsp)[i].name!=NULL) && 
 				    (!strcmp(token[0], (*codecsp)[i].name)) ) {
-					mp_msg(MSGT_CODECCFG,MSGL_ERR,"Codec name '%s' isn't unique.", token[0]);
+					mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNameNotUnique, token[0]);
 					goto err_out_print_linenum;
 				}
 			}
 			if (!(codec->name = strdup(token[0]))) {
-				mp_msg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'name': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupName, strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "info")) {
 			if (codec->info || get_token(1, 1) < 0)
 				goto err_out_parse_error;
 			if (!(codec->info = strdup(token[0]))) {
-				mp_msg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'info': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupInfo, strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "comment")) {
@@ -623,14 +625,14 @@
 			if (get_token(1, 1) < 0)
 				goto err_out_parse_error;
 			if (!(codec->drv = strdup(token[0]))) {
-				mp_msg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'driver': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDriver, strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "dll")) {
 			if (get_token(1, 1) < 0)
 				goto err_out_parse_error;
 			if (!(codec->dll = strdup(token[0]))) {
-				mp_msg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'dll': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDLL, strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "guid")) {
@@ -699,7 +701,7 @@
 	}
 	if (!validate_codec(codec, codec_type))
 		goto err_out_not_valid;
-	mp_msg(MSGT_CODECCFG,MSGL_INFO,"%d audio & %d video codecs\n", nr_acodecs, nr_vcodecs);
+	mp_msg(MSGT_CODECCFG,MSGL_INFO,MSGTR_AudioVideoCodecTotals, nr_acodecs, nr_vcodecs);
 	if(video_codecs) video_codecs[nr_vcodecs].name = NULL;
 	if(audio_codecs) audio_codecs[nr_acodecs].name = NULL;
 out:
@@ -709,7 +711,7 @@
 	return 1;
 
 err_out_parse_error:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError);
 err_out_print_linenum:
 	PRINT_LINENUM;
 err_out:
@@ -726,10 +728,10 @@
 	fclose(fp);
 	return 0;
 err_out_not_valid:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"Codec is not defined correctly.");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecDefinitionIncorrect);
 	goto err_out_print_linenum;
 err_out_release_num:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"This codecs.conf is too old and incompatible with this MPlayer release!");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_OutdatedCodecsConf);
 	goto err_out_print_linenum;
 }
 
--- a/help/help_mp-en.h	Tue Oct 12 08:13:44 2004 +0000
+++ b/help/help_mp-en.h	Tue Oct 12 11:29:21 2004 +0000
@@ -402,6 +402,34 @@
 "                 (320 kbps bitrate)\n"\
 "                 <8-320>: ABR encoding at average given kbps bitrate.\n\n"
 
+//codec-cfg.c:
+#define MSGTR_DuplicateFourcc "duplicated FourCC"
+#define MSGTR_TooManyFourccs "too many FourCCs/formats..."
+#define MSGTR_ParseError "parse error"
+#define MSGTR_ParseErrorFIDNotNumber "parse error (format ID not a number?)"
+#define MSGTR_ParseErrorFIDAliasNotNumber "parse error (format ID alias not a number?)"
+#define MSGTR_DuplicateFID "duplicated format ID"
+#define MSGTR_TooManyOut "too many out..."
+#define MSGTR_InvalidCodecName "\ncodec(%s) name is not valid!\n"
+#define MSGTR_CodecLacksFourcc "\ncodec(%s) does not have FourCC/format!\n"
+#define MSGTR_CodecLacksDriver "\ncodec(%s) does not have a driver!\n"
+#define MSGTR_CodecNeedsDLL "\ncodec(%s) needs a 'dll'!\n"
+#define MSGTR_CodecNeedsOutfmt "\ncodec(%s) needa an 'outfmt'!\n"
+#define MSGTR_CantAllocateComment "Can't allocate memory for comment. "
+#define MSGTR_GetTokenMaxNotLessThanMAX_NR_TOKEN "get_token(): max >= MAX_MR_TOKEN!"
+#define MSGTR_ReadingFile "Reading %s: "
+#define MSGTR_CantOpenFileError "Can't open '%s': %s\n"
+#define MSGTR_CantGetMemoryForLine "Can't get memory for 'line': %s\n"
+#define MSGTR_CantReallocCodecsp "Can't realloc '*codecsp': %s\n"
+#define MSGTR_CodecNameNotUnique "Codec name '%s' isn't unique."
+#define MSGTR_CantStrdupName "Can't strdup -> 'name': %s\n"
+#define MSGTR_CantStrdupInfo "Can't strdup -> 'info': %s\n"
+#define MSGTR_CantStrdupDriver "Can't strdup -> 'driver': %s\n"
+#define MSGTR_CantStrdupDLL "Can't strdup -> 'dll': %s"
+#define MSGTR_AudioVideoCodecTotals "%d audio & %d video codecs\n"
+#define MSGTR_CodecDefinitionIncorrect "Codec is not defined correctly."
+#define MSGTR_OutdatedCodecsConf "This codecs.conf is too old and incompatible with this MPlayer release!"
+
 // open.c, stream.c:
 #define MSGTR_CdDevNotfound "CD-ROM Device '%s' not found.\n"
 #define MSGTR_ErrTrackSelect "Error selecting VCD track."