[MPlayer-dev-eng] [PATCH] multi language part 1/2

Ötvös Attila dc at chello.hu
Wed Dec 10 10:22:42 CET 2008


Ezzel a dátummal: Wednesday 10 December 2008 09.02.45 Diego Biurrun ezt írta:
Hi Diego Biurrun!
> > 01-01-mp_msg_fixed.patch:
> > This patch fixed double " string terminator and
> > change MGSTR_* to MSGTR_*
> > (12x help_mp-*.h)
>
> I already made this change.

Thanks.

> > 01-03-remove-static-string-cat.patch:
> > This patch removed static string cat
>
> Why?
>
> > 01-04-remove-spaces-string.patch:
> > This patch removed spaces string from gui/mplayer/gtk/menu.c
>
> Why?
>
> > 01-05-remove-static-string-cat-about.patch:
> > This patch removed static string cat from gui/mplayer/gtk/about.c
>
> Why?
>

The multi language patch change MSGTR_* "<msg text>" to MSGTR_* 
help_msg[<msgid>][langid]. This patch msg text store in help_msg[] array that 
is why don't correct C code: printf("text1" "text2");. This code change to 
printf("%s%s",help_msg[123][langid],help_msg[124][langid]); is require.

Example:

help_mp.h:
#define MSGTR_MissingVideoStreamBug "Missing video stream!? Contact the 
author, it may be a bug :(\n"

libmpdemux/demux_mpg.c
mp_msg(MSGT_DEMUXER,MSGL_ERR,"MPEG:  " MSGTR_MissingVideoStreamBug);


mp_msg(... , "MPEG:" "Missing video ...");
This code compile OK.

Enable multi language:

help_mp.h:
#define MSGTR_en_MissingVideoStreamBug "Missing video stream!? Contact the 
author, it may be a bug :(\n"
#define MSGTR_de_MissingVideoStreamBug "Fehlender Videostream!? Kontaktiere 
den Autor, dies könnte ein Bug sein :(\n"
help_msg[974] = 
{MSGTR_en_MissingVideoStreamBug,MSGTR_de_MissingVideoStreamBug};
#define MSGTR_MissingVideoStreamBug help_msg[974][langid]

libmpdemux/demux_mpg.c
mp_msg(MSGT_DEMUXER,MSGL_ERR,"MPEG: %s",MSGTR_MissingVideoStreamBug);


mp_msg(...,"MPEG:" help_msg[974][langid]);
This compile Error.

mp_msg(...,"MPEG: %s",help_msg[974][langid]);
This compile OK.

Note:
if msglang="en" -> langid=0
if msglang="de" -> langid=1
if msglang="hu" -> langid=2
...

Best regard.
Attila



More information about the MPlayer-dev-eng mailing list