|
Rockbox mail archiveSubject: Re: question about lang filesRe: question about lang files
From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Mon, 17 Dec 2007 00:25:40 +0100 alex wallis wrote: > But supposing the option isn't voiced in the first place. > i'm guessing we can't just add entrys to the lang file. > i mean for example if i want to add an entry so rockbox announces the > option dump rom contents under debug i'm guessing you can't just add a > string to the lang file and expect it to no instantly where that option > is or when to use the string. You didn't tell me what your objective was, so I assumed that you knew that much. The debug menu doesn't use string ID's because it isn't meant to be localized, and not voiced either. It's a menu for the developers, for debugging. If you still want to do this for your own benefit, add a new LANG ID called LANG_DUMPROM last in english.lang, like I described, then change the string "Dump ROM contents" to ID2P(LANG_DUMPROM) in the menuitems[] array. Then you have to add a get_talk callback in the simplelist in the debug menu. Here is an example patch that does this: ------------------------------------------------------------------------------------ Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 15908) +++ apps/lang/english.lang (working copy) _at__at_ -11512,4 +11512,18 _at__at_ ipodvideo: "Treble Cutoff" </voice> </phrase> +<phrase> + id: LANG_DUMPROM + desc: Dump ROM contents (in the debug menu) + user: + <source> + *: "Dump ROM contents" + </source> + <dest> + *: "Dump ROM contents" + </dest> + <voice> + *: "Dump ROM contents" + </voice> +</phrase> Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 15908) +++ apps/debug_menu.c (working copy) _at__at_ -21,6 +21,8 _at__at_ #include <stdio.h> #include <stdbool.h> #include <string.h> +#include "lang.h" +#include "talk.h" #include "lcd.h" #include "menu.h" #include "debug_menu.h" _at__at_ -2263,7 +2265,7 _at__at_ #endif #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \ (defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200))) - { "Dump ROM contents", dbg_save_roms }, + { ID2P(LANG_DUMPROM), dbg_save_roms }, #endif #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440 { "View I/O ports", dbg_ports }, _at__at_ -2342,6 +2344,14 _at__at_ (void)data; (void)buffer; return menuitems[item].desc; } + +static int debug_speak_item(int selected_item, void * data) +{ + (void)data; + talk_id(P2ID(menuitems[selected_item].desc), false); + return 0; +} + bool debug_menu(void) { struct simplelist_info info; _at__at_ -2349,6 +2359,8 _at__at_ simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL); info.action_callback = menu_action_callback; info.get_name = dbg_menu_getname; + if(global_settings.talk_menu) + info.get_talk = debug_speak_item; return simplelist_show_list(&info); } ------------------------------------------------------------------------------------ Enjoy! Linus Received on 2007-12-17 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |