Mercurial > mplayer.hg
comparison gui/mplayer/gui_common.c @ 32713:f49e1b37281a
Translate messages shown in the GUI window(s) from UTF-8
because the font file only holds a single byte character set font
author | ib |
---|---|
date | Wed, 19 Jan 2011 22:18:07 +0000 |
parents | f1b29f413940 |
children | d78209361383 |
comparison
equal
deleted
inserted
replaced
32712:6ff3cc81d602 | 32713:f49e1b37281a |
---|---|
53 static inline void TranslateFilename( int c,char * tmp,size_t tmplen ) | 53 static inline void TranslateFilename( int c,char * tmp,size_t tmplen ) |
54 { | 54 { |
55 int i; | 55 int i; |
56 char * p; | 56 char * p; |
57 size_t len; | 57 size_t len; |
58 gchar *msg = NULL; | |
58 | 59 |
59 switch ( guiIntfStruct.StreamType ) | 60 switch ( guiIntfStruct.StreamType ) |
60 { | 61 { |
61 case STREAMTYPE_STREAM: | 62 case STREAMTYPE_STREAM: |
62 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); | 63 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); |
70 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); | 71 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); |
71 len=strlen( tmp ); | 72 len=strlen( tmp ); |
72 if ( ( len > 3 )&&( tmp[len - 3] == '.' ) ) tmp[len - 3]=0; | 73 if ( ( len > 3 )&&( tmp[len - 3] == '.' ) ) tmp[len - 3]=0; |
73 else if ( ( len > 4 )&&( tmp[len - 4] == '.' ) ) tmp[len - 4]=0; | 74 else if ( ( len > 4 )&&( tmp[len - 4] == '.' ) ) tmp[len - 4]=0; |
74 else if ( ( len > 5 )&&( tmp[len - 5] == '.' ) ) tmp[len - 5]=0; | 75 else if ( ( len > 5 )&&( tmp[len - 5] == '.' ) ) tmp[len - 5]=0; |
75 } else av_strlcpy( tmp,MSGTR_NoFileLoaded,tmplen ); | 76 } |
77 else | |
78 { | |
79 msg = g_filename_from_utf8( MSGTR_NoFileLoaded, -1, NULL, NULL, NULL ); | |
80 av_strlcpy( tmp, msg, tmplen ); | |
81 } | |
76 break; | 82 break; |
77 #ifdef CONFIG_DVDREAD | 83 #ifdef CONFIG_DVDREAD |
78 case STREAMTYPE_DVD: | 84 case STREAMTYPE_DVD: |
79 if ( guiIntfStruct.DVD.current_chapter ) snprintf(tmp,tmplen,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter ); | 85 if ( guiIntfStruct.DVD.current_chapter ) |
80 else av_strlcat( tmp,MSGTR_NoChapter,tmplen ); | 86 { |
87 msg = g_filename_from_utf8( MSGTR_Chapter, -1, NULL, NULL, NULL ); | |
88 snprintf( tmp, tmplen, msg, guiIntfStruct.DVD.current_chapter ); | |
89 } | |
90 else | |
91 { | |
92 msg = g_filename_from_utf8( MSGTR_NoChapter, -1, NULL, NULL, NULL ); | |
93 av_strlcat( tmp, msg, tmplen ); | |
94 } | |
81 break; | 95 break; |
82 #endif | 96 #endif |
83 #ifdef CONFIG_VCD | 97 #ifdef CONFIG_VCD |
84 case STREAMTYPE_VCD: | 98 case STREAMTYPE_VCD: |
85 snprintf( tmp,tmplen,MSGTR_VCDTrack,guiIntfStruct.Track ); | 99 msg = g_filename_from_utf8( MSGTR_VCDTrack, -1, NULL, NULL, NULL ); |
100 snprintf( tmp, tmplen, msg, guiIntfStruct.Track ); | |
86 break; | 101 break; |
87 #endif | 102 #endif |
88 default: av_strlcpy( tmp,MSGTR_NoMediaOpened,tmplen ); | 103 default: |
89 } | 104 msg = g_filename_from_utf8( MSGTR_NoMediaOpened, -1, NULL, NULL, NULL ); |
105 av_strlcpy( tmp, msg, tmplen ); | |
106 } | |
107 g_free(msg); | |
90 if ( c ) | 108 if ( c ) |
91 { | 109 { |
92 for ( i=0;i < (int)strlen( tmp );i++ ) | 110 for ( i=0;i < (int)strlen( tmp );i++ ) |
93 { | 111 { |
94 int t=0; | 112 int t=0; |