changeset 5102:17f97ed8259e

added i18n support
author alex
date Fri, 15 Mar 2002 21:08:14 +0000
parents 870ba1ffdbf9
children d546600f0109
files mp_msg.c
diffstat 1 files changed, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mp_msg.c	Fri Mar 15 21:07:48 2002 +0000
+++ b/mp_msg.c	Fri Mar 15 21:08:14 2002 +0000
@@ -10,7 +10,6 @@
 extern void gtkMessageBox( int type,char * str );
 extern int use_gui;
 #endif
-
 #include "mp_msg.h"
 
 static int mp_msg_levels[MSGT_MAX]; // verbose level of this module
@@ -25,6 +24,41 @@
 }
 
 void mp_msg_c( int x, const char *format, ... ){
+#if 1
+    va_list va;
+    char tmp[2048];
+    
+    if((x&255)>mp_msg_levels[x>>8]) return; // do not display
+    va_start(va, mp_gettext(format));
+    vsnprintf(tmp, 2048, mp_gettext(format), va);
+    tmp[2047] = 0;
+
+#if defined(HAVE_NEW_GUI) && !defined(HAVE_MENCODER)
+    if(use_gui)
+    {
+	switch(x & 255)
+	{
+	    case MSGL_FATAL:
+		gtkMessageBox(GTK_MB_FATAL|GTK_MB_SIMPLE, tmp);
+		break;
+	    case MSGL_ERR:
+		gtkMessageBox(GTK_MB_ERROR|GTK_MB_SIMPLE, tmp);
+		break;
+	    case MSGL_WARN:
+		gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, tmp);
+		break;
+	}
+    }
+#endif
+
+    fprintf(stderr, "%s", tmp);
+    if ((x & 255) <= MSGL_ERR)
+	fflush(stderr);
+    else
+	fflush(stdout);
+
+    va_end(va);
+#else
     va_list va;
     if((x&255)>mp_msg_levels[x>>8]) return; // do not display
     va_start(va, format);
@@ -64,6 +98,7 @@
       fflush(stdout);
     }
     va_end(va);
+#endif
 }
 
 #else