From e306174952d42e1cd6cc5efc50ae6bb0410501bc Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Tue, 7 Jul 2009 01:15:02 +0300 Subject: Translation system changes part 2: replace macros by strings Replace all MSGTR_ macros in the source by the corresponding English string. --- libmenu/menu.c | 26 +++++++++++++------------- libmenu/menu_cmdlist.c | 8 ++++---- libmenu/menu_console.c | 16 ++++++++-------- libmenu/menu_filesel.c | 12 ++++++------ libmenu/menu_param.c | 12 ++++++------ libmenu/menu_pt.c | 4 ++-- libmenu/menu_txt.c | 8 ++++---- libmenu/vf_menu.c | 4 ++-- 8 files changed, 45 insertions(+), 45 deletions(-) (limited to 'libmenu') diff --git a/libmenu/menu.c b/libmenu/menu.c index 5c65bd02f0..ed67cc9f2e 100644 --- a/libmenu/menu.c +++ b/libmenu/menu.c @@ -114,7 +114,7 @@ static int menu_parse_config(char* buffer, struct m_config *mconfig) while(1) { r = asx_get_element(parser,&buffer,&element,&body,&attribs); if(r < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line); asx_parser_free(parser); return 0; } else if(r == 0) { @@ -124,7 +124,7 @@ static int menu_parse_config(char* buffer, struct m_config *mconfig) // Has it a name ? name = asx_get_attrib("name",attribs); if(!name) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuDefinitionsNeedANameAttrib,parser->line); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu definitions need a name attribute (line %d).\n",parser->line); free(element); if(body) free(body); asx_free_attribs(attribs); @@ -156,7 +156,7 @@ static int menu_parse_config(char* buffer, struct m_config *mconfig) for(;;) { r = asx_get_element(parser,&bd,&element,&b,&attribs); if(r < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine, + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n", parser->line); free(body); asx_parser_free(parser); @@ -209,13 +209,13 @@ static int menu_parse_config(char* buffer, struct m_config *mconfig) for(i = 0 ; attribs[2*i] ; i++) { if(strcasecmp(attribs[2*i],"name") == 0) continue; if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1])) - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1], + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] bad attribute %s=%s in menu '%s' at line %d\n",attribs[2*i],attribs[2*i+1], name,parser->line); } menu_count++; memset(&menu_list[menu_count],0,sizeof(menu_def_t)); } else { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] unknown menu type '%s' at line %d\n",element,parser->line); free(name); if(body) free(body); } @@ -243,7 +243,7 @@ int menu_init(struct MPContext *mpctx, struct m_config *mconfig, #endif fd = open(cfg_file, O_RDONLY); if(fd < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantOpenConfigFile,cfg_file); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't open menu config file: %s\n",cfg_file); return 0; } buffer = malloc(bl); @@ -251,7 +251,7 @@ int menu_init(struct MPContext *mpctx, struct m_config *mconfig, int r; if(bl - br < BUF_MIN) { if(bl >= BUF_MAX) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsTooBig,BUF_MAX/1024); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Config file is too big (> %d KB)\n",BUF_MAX/1024); close(fd); free(buffer); return 0; @@ -264,7 +264,7 @@ int menu_init(struct MPContext *mpctx, struct m_config *mconfig, br += r; } if(!br) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsEmpty); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Config file is empty.\n"); return 0; } buffer[br-1] = '\0'; @@ -329,7 +329,7 @@ menu_t* menu_open(char *name) { break; } if(menu_list[i].name == NULL) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuNotFound,name); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu %s not found.\n",name); return NULL; } m = calloc(1,sizeof(menu_t)); @@ -344,7 +344,7 @@ menu_t* menu_open(char *name) { if(m->priv) m_struct_free(m->priv_st,m->priv); free(m); - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuInitFailed,name); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu '%s': Init failed.\n",name); return NULL; } @@ -482,7 +482,7 @@ void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) { int font; if(!draw_alpha) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n"); return; } @@ -516,7 +516,7 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt, draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); if(!draw_alpha) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n"); return; } @@ -758,7 +758,7 @@ void menu_draw_box(mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x int g; if(!draw_alpha) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n"); return; } diff --git a/libmenu/menu_cmdlist.c b/libmenu/menu_cmdlist.c index e4896866fc..5516af1ff6 100644 --- a/libmenu/menu_cmdlist.c +++ b/libmenu/menu_cmdlist.c @@ -119,19 +119,19 @@ static int parse_args(menu_t* menu,char* args) { while(1) { r = asx_get_element(parser,&args,&element,&body,&attribs); if(r < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line); asx_parser_free(parser); return -1; } else if(r == 0) { asx_parser_free(parser); if(!m) - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] No entry found in the menu definition.\n"); return m ? 1 : 0; } // Has it a name ? name = asx_get_attrib("name",attribs); if(!name) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuEntryDefinitionsNeedAName,parser->line); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu entry definitions need a name (line %d).\n",parser->line); free(element); if(body) free(body); asx_free_attribs(attribs); @@ -157,7 +157,7 @@ static int open_cmdlist(menu_t* menu, char* args) { menu->close = close_menu; if(!args) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuNeedsAnArgument); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu needs an argument.\n"); return 0; } diff --git a/libmenu/menu_console.c b/libmenu/menu_console.c index c83872f789..85aa7a9234 100644 --- a/libmenu/menu_console.c +++ b/libmenu/menu_console.c @@ -265,10 +265,10 @@ static void check_child(menu_t* menu) { mpriv->prompt = mpriv->mp_prompt; //add_line(mpriv,"Child process exited"); } - else mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WaitPidError,strerror(errno)); + else mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Waitpid error: %s.\n",strerror(errno)); } } else if(r < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_SelectError); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Select error.\n"); return; } @@ -278,7 +278,7 @@ static void check_child(menu_t* menu) { if(w) mpriv->add_line = 1; r = read(mpriv->child_fd[i],buffer,255); if(r < 0) - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReadErrorOnChildFD, i == 1 ? "stdout":"stderr"); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Read error on child's file descriptor: %s.\n", i == 1 ? "stdout":"stderr"); else if(r>0) { buffer[r] = '\0'; add_string(mpriv,buffer); @@ -296,9 +296,9 @@ static int run_shell_cmd(menu_t* menu, char* cmd) { #ifndef __MINGW32__ int in[2],out[2],err[2]; - mp_tmsg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ConsoleRun,cmd); + mp_tmsg(MSGT_GLOBAL,MSGL_INFO,"[MENU] Console run: %s ...\n",cmd); if(mpriv->child) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_AChildIsAlreadyRunning); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] A child is already running.\n"); return 0; } @@ -308,7 +308,7 @@ static int run_shell_cmd(menu_t* menu, char* cmd) { mpriv->child = fork(); if(mpriv->child < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ForkFailed); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Fork failed !!!\n"); close_pipe(in); close_pipe(out); close_pipe(err); @@ -382,14 +382,14 @@ static void read_cmd(menu_t* menu,int cmd) { while(l > 0) { int w = write(mpriv->child_fd[0],str,l); if(w < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] write error\n"); break; } l -= w; str += w; } if(write(mpriv->child_fd[0],"\n",1) < 0) - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] write error\n"); enter_cmd(menu); return; } diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index 734e61bbb4..8c562e0871 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -249,7 +249,7 @@ static int open_dir(menu_t* menu,char* args) { mpriv->p.title = replace_path(mpriv->title,mpriv->dir,0); if ((dirp = opendir (mpriv->dir)) == NULL){ - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_OpendirError, strerror(errno)); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] opendir error: %s\n", strerror(errno)); return 0; } @@ -291,7 +291,7 @@ static int open_dir(menu_t* menu,char* args) { if(n%20 == 0){ // Get some more mem if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *))) == NULL) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno)); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] realloc error: %s\n", strerror(errno)); n--; goto bailout; } @@ -300,7 +300,7 @@ static int open_dir(menu_t* menu,char* args) { namelist[n] = (char *) malloc(strlen(dp->d_name) + 2); if(namelist[n] == NULL){ - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] memory allocation error: %s\n", strerror(errno)); n--; goto bailout; } @@ -318,7 +318,7 @@ bailout: qsort(namelist, n, sizeof(char *), (kill_warn)compare); if (n < 0) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReaddirError,strerror(errno)); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] readdir error: %s\n",strerror(errno)); return 0; } while(n--) { @@ -329,7 +329,7 @@ bailout: e->d = 1; menu_list_add_entry(menu,e); }else{ - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] memory allocation error: %s\n", strerror(errno)); } free(namelist[n]); } @@ -368,7 +368,7 @@ static void read_cmd(menu_t* menu,int cmd) { } menu_list_uninit(menu,free_entry); if(!open_dir(menu,p)) { - mp_tmsg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_CantOpenDirectory,p); + mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Can't open directory %s.\n",p); menu->cl = 1; } free(p); diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c index af828c20f0..7e3a4f1a1c 100644 --- a/libmenu/menu_param.c +++ b/libmenu/menu_param.c @@ -117,13 +117,13 @@ static int parse_args(menu_t* menu,char* args) { while(1) { r = asx_get_element(parser,&args,&element,&body,&attribs); if(r < 0) { - mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line); + mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,"[MENU] syntax error at line: %d\n",parser->line); asx_parser_free(parser); return -1; } else if(r == 0) { asx_parser_free(parser); if(!m) - mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition); + mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] No entry found in the menu definition.\n"); m = calloc(1,sizeof(struct list_entry_s)); m->p.txt = strdup("Back"); menu_list_add_entry(menu,m); @@ -132,7 +132,7 @@ static int parse_args(menu_t* menu,char* args) { if(!strcmp(element,"menu")) { name = asx_get_attrib("menu",attribs); if(!name) { - mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_SubmenuDefinitionNeedAMenuAttribut); + mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Submenu definition needs a 'menu' attribute.\n"); goto next_element; } m = calloc(1,sizeof(struct list_entry_s)); @@ -147,13 +147,13 @@ static int parse_args(menu_t* menu,char* args) { name = asx_get_attrib("property",attribs); opt = NULL; if(name && mp_property_do(name,M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) { - mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_InvalidProperty, + mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Invalid property '%s' in pref menu entry. (line %d).\n", name,parser->line); goto next_element; } txt = asx_get_attrib("txt",attribs); if(!(name || txt)) { - mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_PrefMenuEntryDefinitionsNeed,parser->line); + mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Pref menu entry definitions need a valid 'property' or 'txt' attribute (line %d).\n",parser->line); if(txt) free(txt), txt = NULL; goto next_element; } @@ -278,7 +278,7 @@ static int openMenu(menu_t* menu, char* args) { if(!args) { - mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_PrefMenuNeedsAnArgument); + mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,"[MENU] Pref menu needs an argument.\n"); return 0; } diff --git a/libmenu/menu_pt.c b/libmenu/menu_pt.c index 67e129d7ca..3378d93d64 100644 --- a/libmenu/menu_pt.c +++ b/libmenu/menu_pt.c @@ -98,7 +98,7 @@ static void read_cmd(menu_t* menu,int cmd) { d--; } if(i == NULL) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantfindTheTargetItem); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't find the target item ????\n"); break; } } @@ -111,7 +111,7 @@ static void read_cmd(menu_t* menu,int cmd) { mp_input_queue_cmd(menu->input_ctx, c); } else - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToBuildCommand,str); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Failed to build command: %s.\n",str); } break; default: menu_list_read_cmd(menu,cmd); diff --git a/libmenu/menu_txt.c b/libmenu/menu_txt.c index 4ebc4e3355..4ce2ce487c 100644 --- a/libmenu/menu_txt.c +++ b/libmenu/menu_txt.c @@ -141,13 +141,13 @@ static int open_txt(menu_t* menu, char* args) { menu->read_cmd = read_cmd; if(!mpriv->file) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtNeedATxtFileName); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Text menu needs a textfile name (parameter file).\n"); return 0; } fd = fopen(mpriv->file,"r"); if(!fd) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtCantOpen,mpriv->file); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't open %s.\n",mpriv->file); return 0; } @@ -178,7 +178,7 @@ static int open_txt(menu_t* menu, char* args) { mpriv->num_lines++; } if(pos >= BUF_SIZE-1) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_WarningTooLongLineSplitting); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Warning, line too long. Splitting it.\n"); mpriv->lines = realloc(mpriv->lines,(mpriv->num_lines + 1)*sizeof(char*)); mpriv->lines[mpriv->num_lines] = strdup(buf); mpriv->num_lines++; @@ -186,7 +186,7 @@ static int open_txt(menu_t* menu, char* args) { } } - mp_tmsg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ParsedLines,mpriv->num_lines); + mp_tmsg(MSGT_GLOBAL,MSGL_INFO,"[MENU] Parsed %d lines.\n",mpriv->num_lines); return 1; } diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c index 2eadad6741..84b9197aa7 100644 --- a/libmenu/vf_menu.c +++ b/libmenu/vf_menu.c @@ -99,7 +99,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) { else if(strcmp(arg,"hide") == 0 || strcmp(arg,"toggle") == 0) priv->current->show = 0; else - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unknown command: '%s'.\n",arg); return 1; } case MP_CMD_SET_MENU : { @@ -107,7 +107,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) { menu_t* l = priv->current; priv->current = menu_open(menu); if(!priv->current) { - mp_tmsg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu); + mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Failed to open menu: '%s'.\n",menu); priv->current = l; priv->current->show = 0; } else { -- cgit v1.2.3