added i18n support

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5103 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
alex 2002-03-15 21:08:14 +00:00
parent 7fcc5156dc
commit d89ed740ad
1 changed files with 36 additions and 1 deletions

View File

@ -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_init(int verbose){
}
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 @@ void mp_msg_c( int x, const char *format, ... ){
fflush(stdout);
}
va_end(va);
#endif
}
#else