|
Rockbox mail archiveSubject: New patch : UI languageNew patch : UI language
From: Pierre-Yves Vasener <pyvasene_at_free.fr>
Date: Fri, 26 Jul 2002 14:51:38 +0200 Hello, I've created a patch to add the support of the UI language selection. I'm really not a C programming guru, so the team has to review and improve the code but I think it's a good start to implement this feature. The patch only includes the translation of the "Sound menu" string to stay easily readeable. If you have any question or comment, mail me if I'm not connected via IRC. Cheers. -- Pierre-Yves Vasener Email : pyvasene_at_free.fr ? apps/i18n.c ? apps/i18n.h Index: apps/main.c =================================================================== RCS file: /cvsroot/rockbox/apps/main.c,v retrieving revision 1.39 diff -u -b -r1.39 main.c --- apps/main.c 25 Jul 2002 15:55:21 -0000 1.39 +++ apps/main.c 26 Jul 2002 12:44:36 -0000 _at__at_ -43,6 +43,7 _at__at_ #include "backlight.h" #include "status.h" #include "debug_menu.h" +#include "i18n.h" #include "version.h" _at__at_ -66,6 +67,7 _at__at_ lcd_init(); show_logo(); settings_reset(); + set_lang(global_settings.language); sleep(HZ/2); } _at__at_ -84,6 +86,7 _at__at_ kernel_init(); settings_reset(); + set_lang(global_settings.language); dmalloc_initialize(); bmalloc_add_pool(poolstart, poolend-poolstart); _at__at_ -94,6 +97,7 _at__at_ #ifdef DEBUG debug_init(); #endif + set_irq_level(0); i2c_init(); Index: apps/main_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/main_menu.c,v retrieving revision 1.42 diff -u -b -r1.42 main_menu.c --- apps/main_menu.c 24 Jul 2002 16:57:21 -0000 1.42 +++ apps/main_menu.c 26 Jul 2002 12:44:36 -0000 _at__at_ -32,6 +32,7 _at__at_ #include "settings.h" #include "settings_menu.h" #include "sound_menu.h" +#include "i18n.h" #ifdef HAVE_LCD_BITMAP #include "games_menu.h" _at__at_ -40,6 +41,8 _at__at_ #include "icons.h" #endif +#include "debug.h" + int show_logo( void ) { #ifdef HAVE_LCD_BITMAP _at__at_ -160,10 +163,9 _at__at_ void main_menu(void) { int m; - /* main menu */ struct menu_items items[] = { - { "Sound Settings", sound_menu }, + { translate(SOUND_MENU), sound_menu }, { "General Settings", settings_menu }, #ifdef HAVE_LCD_BITMAP { "Games", games_menu }, Index: apps/settings.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings.c,v retrieving revision 1.11 diff -u -b -r1.11 settings.c --- apps/settings.c 25 Jul 2002 15:55:21 -0000 1.11 +++ apps/settings.c 26 Jul 2002 12:44:36 -0000 _at__at_ -55,6 +55,7 _at__at_ 0x0f 0x23 <scroll speed & WPS display byte> 0x10 0x24 <playlist options byte> 0x11 0x25 <AVC byte> +0x12 0x26 <language byte> <all unused space filled with 0xff> _at__at_ -218,6 +219,7 _at__at_ (global_settings.wps_display & 7)); rtc_config_block[0x11] = (unsigned char)global_settings.avc; + rtc_config_block[0x12] = (unsigned char)global_settings.language; memcpy(&rtc_config_block[0x24], &global_settings.total_uptime, 4); memcpy(&rtc_config_block[0x28], &global_settings.total_boots, 2); _at__at_ -284,6 +286,9 _at__at_ if (rtc_config_block[0x11] != 0xFF) global_settings.avc = rtc_config_block[0x11]; + if (rtc_config_block[0x12] != 0xFF) + global_settings.language = rtc_config_block[0x12]; + if (rtc_config_block[0x24] != 0xFF) memcpy(&global_settings.total_uptime, &rtc_config_block[0x24], 4); if (rtc_config_block[0x28] != 0xFF) _at__at_ -317,6 +322,7 _at__at_ global_settings.total_boots = 0; global_settings.total_uptime = 0; global_settings.scroll_speed = 8; + global_settings.language = DEFAULT_LANGUAGE_SETTING; } _at__at_ -336,10 +342,11 _at__at_ global_settings.loudness, global_settings.bass_boost ); - DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight:\t%d\n", + DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight:\t%d\nlanguage:\t%d\n", global_settings.contrast, global_settings.poweroff, - global_settings.backlight ); + global_settings.backlight, + global_settings.language ); #endif } Index: apps/settings.h =================================================================== RCS file: /cvsroot/rockbox/apps/settings.h,v retrieving revision 1.8 diff -u -b -r1.8 settings.h --- apps/settings.h 25 Jul 2002 15:55:22 -0000 1.8 +++ apps/settings.h 26 Jul 2002 12:44:37 -0000 _at__at_ -45,6 +45,7 _at__at_ int contrast; /* lcd contrast: 0-100 0=low 100=high */ int poweroff; /* power off timer: 0-100 0=never:each 1% = 60 secs */ int backlight; /* backlight off timer: 0-100 0=never:each 1% = 10 secs */ + int language; /* language of the UI: 0-100 0=english, 1=french ... */ /* resume settings */ _at__at_ -100,5 +101,6 _at__at_ #define DEFAULT_POWEROFF_SETTING 0 #define DEFAULT_BACKLIGHT_SETTING 5 #define DEFAULT_WPS_DISPLAY 0 +#define DEFAULT_LANGUAGE_SETTING 0 #endif /* __SETTINGS_H__ */ Index: apps/settings_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings_menu.c,v retrieving revision 1.7 diff -u -b -r1.7 settings_menu.c --- apps/settings_menu.c 22 Jul 2002 16:39:17 -0000 1.7 +++ apps/settings_menu.c 26 Jul 2002 12:44:37 -0000 _at__at_ -28,6 +28,7 _at__at_ #include "kernel.h" #include "sprintf.h" +#include "i18n.h" #include "settings.h" #include "settings_menu.h" #include "backlight.h" _at__at_ -55,6 +56,13 _at__at_ backlight_on(); } +static void language(void) +{ + char* languages[] = { "English ", "Français ", "Deutsch" }; + set_option("[Language]", &global_settings.language, languages, 3 ); + set_lang(global_settings.language); +} + static void scroll_speed(void) { set_int("Scroll speed indicator...", "", &global_settings.scroll_speed, _at__at_ -71,6 +79,7 _at__at_ { int m; struct menu_items items[] = { + { "Language", language }, { "Shuffle", shuffle }, { "MP3/M3U filter", mp3_filter }, { "Sort mode", sort_case }, Index: uisimulator/x11/Makefile =================================================================== RCS file: /cvsroot/rockbox/uisimulator/x11/Makefile,v retrieving revision 1.50 diff -u -b -r1.50 Makefile --- uisimulator/x11/Makefile 22 Jul 2002 22:59:47 -0000 1.50 +++ uisimulator/x11/Makefile 26 Jul 2002 12:44:37 -0000 _at__at_ -76,7 +76,7 _at__at_ FIRMSRCS = chartables.c lcd.c sprintf.c id3.c debug.c usb.c mpeg.c power.c APPS = main.c tree.c menu.c credits.c main_menu.c\ - playlist.c showtext.c wps.c settings.c status.c + playlist.c showtext.c wps.c settings.c status.c i18n.c MENUS = games_menu.c screensavers_menu.c settings_menu.c sound_menu.c _at__at_ -183,6 +183,9 _at__at_ $(CC) $(APPCFLAGS) -c $< -o $_at_ $(OBJDIR)/wps.o: $(APPDIR)/wps.c + $(CC) $(APPCFLAGS) -c $< -o $_at_ + +$(OBJDIR)/i18n.o: $(APPDIR)/i18n.c $(CC) $(APPCFLAGS) -c $< -o $_at_ $(OBJDIR)/bmp.o: $(RECDIR)/bmp.c Received on 2002-07-26 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |