diff --git a/apps/Makefile b/apps/Makefile index a501bb2747..3f99798e67 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -13,9 +13,11 @@ AR = sh-elf-ar AS = sh-elf-as OC = sh-elf-objcopy +LANGUAGE = english + FIRMWARE := ../firmware -INCLUDES= -I$(FIRMWARE)/include -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I$(FIRMWARE)/malloc -I. +INCLUDES= -I$(FIRMWARE)/include -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I$(FIRMWARE)/malloc -I. -I$(OBJDIR) # store output files in this directory: OBJDIR = . @@ -47,7 +49,7 @@ else OUTNAME = archos.mod endif -OBJS := $(SRC:%.c=$(OBJDIR)/%.o) +OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o) all : $(OBJDIR)/$(OUTNAME) @@ -70,6 +72,10 @@ $(OBJDIR)/%.o: %.c @mkdir -p `dirname $@` $(CC) $(CFLAGS) -c $< -o $@ +$(OBJDIR)/lang.o: lang/$(LANGUAGE).lang + ../tools/genlang -p=$(OBJDIR)/lang $< + $(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@ + dist: tar czvf dist.tar.gz Makefile main.c start.s app.lds diff --git a/apps/demo_menu.c b/apps/demo_menu.c index cbd5742c7c..de625c5821 100644 --- a/apps/demo_menu.c +++ b/apps/demo_menu.c @@ -31,6 +31,8 @@ #include "kernel.h" #include "sprintf.h" +#include "lang.h" + extern Menu bounce(void); extern Menu snow(void); @@ -40,8 +42,8 @@ Menu demo_menu(void) Menu result; struct menu_items items[] = { - { "Bounce", bounce }, - { "Snow", snow }, + { str(LANG_BOUNCE), bounce }, + { str(LANG_SNOW), snow }, }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); diff --git a/apps/games_menu.c b/apps/games_menu.c index dd0c671be4..6ab1faf7e6 100644 --- a/apps/games_menu.c +++ b/apps/games_menu.c @@ -34,6 +34,8 @@ #include "sokoban.h" #include "wormlet.h" +#include "lang.h" + extern Menu tetris(void); extern Menu snake(void); @@ -43,10 +45,10 @@ Menu games_menu(void) Menu result; struct menu_items items[] = { - { "Tetris", tetris }, - { "Sokoban", sokoban }, - { "Wormlet", wormlet }, - { "Snake", snake } + { str(LANG_TETRIS), tetris }, + { str(LANG_SOKOBAN), sokoban }, + { str(LANG_WORMLET), wormlet }, + { str(LANG_SNAKE), snake } }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); diff --git a/apps/lang.c b/apps/lang.c deleted file mode 100644 index af8b16aa5a..0000000000 --- a/apps/lang.c +++ /dev/null @@ -1,16 +0,0 @@ -/* This file was automaticly generated using genlang, the strings come - from "lang/english.lang" */ - -unsigned char *language_strings[]={ - "Sound Settings", - "General Settings", - "Games", - "Demos", - "Info", - "Version", - "Debug (keep out!)", - "Rockbox info:", - "Buf: %d.%02dMb", - "Buffer: %d.%02dMb", -}; -/* end of generated string list */ diff --git a/apps/lang.h b/apps/lang.h deleted file mode 100644 index b841271eff..0000000000 --- a/apps/lang.h +++ /dev/null @@ -1,25 +0,0 @@ -/* This file was automaticly generated using genlang */ -/* - * The str() macro/functions is how to access strings that might be - * translated. Use it like str(MACRO) and expect a string to be - * returned! - */ -#define str(x) language_strings[x] - -/* this is the array with all the strings */ -extern unsigned char *language_strings[]; - -/* The enum below contains all available strings */ -enum { - LANG_SOUND_SETTINGS, - LANG_GENERAL_SETTINGS, - LANG_GAMES, - LANG_DEMOS, - LANG_INFO, - LANG_VERSION, - LANG_DEBUG, - LANG_ROCKBOX_INFO, - LANG_BUFFER_STAT_PLAYER, - LANG_BUFFER_STAT_RECORDER, -}; -/* end of generated enum list */ diff --git a/apps/lang/english.lang b/apps/lang/english.lang index db99993471..4d89d2e9f7 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -33,6 +33,11 @@ desc: in the main menu eng: "Debug (keep out!)" new: +id: LANG_USB +desc: in the main menu +eng: "USB (sim)" +new: + id: LANG_ROCKBOX_INFO desc: displayed topmost on the info screen eng: "Rockbox info:" @@ -48,3 +53,731 @@ desc: the buffer size recorder-screen width, %d MB %d fraction of MB eng: "Buffer: %d.%02dMb" new: +id: LANG_BATTERY_LEVEL_PLAYER +desc: the battery level in percentage +eng: "Batt: %d%%%s" +new: + +id: LANG_BATTERY_LEVEL_RECORDER +desc: the battery level in percentage +eng: "Battery: %d%%%s" +new: + +id: LANG_BATTERY_CHARGE +desc: tells that the battery is charging, instead of battery level +eng: "Battery: charging" +new: + +id: LANG_BOUNCE +desc: in the demos menu +eng: "Bounce" +new: + +id: LANG_SNOW +desc: in the demos menu +eng: "Snow" +new: + +id: LANG_TETRIS +desc: in the games menu +eng: "Tetris" +new: + +id: LANG_SOKOBAN +desc: in the games menu +eng: "Sokoban" +new: + +id: LANG_WORMLET +desc: in the games menu +eng: "Wormlet" +new: + +id: LANG_SNAKE +desc: in the games menu +eng: "Snake" +new: + +id: LANG_PLAYLIST_LOAD +desc: displayed on screen while loading a playlist +eng: "Loading..." +new: + +id: LANG_PLAYLIST_SHUFFLE +desc: displayed on screen while shuffling a playlist +eng: "Shuffling..." +new: + +id: LANG_PLAYLIST_PLAY +desc: displayed on screen when start playing a playlist +eng: "Playing..." +new: + +id: LANG_PLAYINDICES_PLAYLIST +desc: in playlist.indices() when playlist is full +eng: "Playlist" +new: + +id: LANG_PLAYINDICES_BUFFER +desc: in playlist.indices() when playlist is full +eng: "buffer full" +new: + +id: LANG_PLAYINDICES_AMOUNT +desc: number of files in playlist +eng: "%d files" +new: + +id: LANG_SETTINGS_SAVE_PLAYER +desc: displayed if save settings has failed +eng: "Save failed" +new: + +id: LANG_SETTINGS_BATTERY_PLAYER +desc: if save settings has failed +eng: "Batt. low?" +new: + +id: LANG_SETTINGS_SAVE_RECORDER +desc: displayed if save settings has failed +eng: "Save failed" +new: + +id: LANG_SETTINGS_BATTERY_RECORDER +desc: if save settings has failed +eng: "Is battery low?" +new: + +id: LANG_TIME_SET +dec: used in set_time() +eng: "ON to set" +new: + +id: LANG_TIME_REVERT +desc: used in set_time() +eng: "OFF to revert" +new: + +id: LANG_HIDDEN +desc: in settings_menu +eng: "Hidden Files" +new: + +id: LANG_HIDDEN_SHOW +desc: in settings_menu +eng: "Show" +new: + +id: LANG_HIDDEN_HIDE +desc: in settings_menu +eng: "Hide" +new: + +id: LANG_CONTRAST +desc: in settings_menu +eng: "Contrast" +new: + +id: LANG_SHUFFLE +desc: in settings_menu +eng: "Shuffle" +new: + +id: LANG_PLAY_SELECTED +desc: in settings_menu +eng: "Play selected first" +new: + +id: LANG_MP3FILTER +desc: in settings_menu +eng: "Music Filter" +new: + +id: LANG_SORT_CASE +desc: in settings_menu +eng: "Sort Case Sensitive" +new: + +id: LANG_RESUME +desc: in settings_menu +eng: "Resume" +new: + +id: LANG_OFF +desc: Used in a lot of places +eng: "Off" +new: + +id: LANG_RESUME_SETTING_ASK +desc: in settings_menu +eng: "ask" +new: + +id: LANG_ON +desc: Used in a lot of places +eng: "On" +new: + +id: LANG_BACKLIGHT +desc: in settings_menu +eng: "Backlight" +new: + +id: LANG_BACKLIGHT_ON +desc: in settings_menu, + +id: LANG_SCROLL +desc: in settings_menu +eng: "Scroll Speed Setting Example" +new: + +id: LANG_DISCHARGE +desc: in settings_menu +eng: "Deep discharge" +new: + +id: LANG_TIME +desc: in settings_menu +eng: "Set Time/Date" +new: + +id: LANG_SPINDOWN +desc: in settings_menu +eng: "Disk Spindown" +new: + +id: LANG_FFRW_STEP +desc: in settings_menu +eng: "FF/RW Min Step" +new: + +id: LANG_FFRW_ACCEL +desc: in settings_menu +eng: "FF/RW Accel" +new: + +id: LANG_FOLLOW +desc: in settings_menu +eng: "Follow Playlist" +new: + +id: LANG_RESET_ASK_PLAYER +desc: confirm to reset settings +eng: "Really?" +new: + +id: LANG_RESET_CONFIRM_PLAYER +desc: confirm to reset settings +eng: "Play/Stop" +new: + +id: LANG_RESET_ASK_RECORDER +desc: confirm to reset settings +eng: "Are you sure?" +new: + +id: LANG_RESET_CONFIRM_RECORDER +desc: confirm to reset settings +eng: "Play = Yes" +new: + +id: LANG_RESET_CANCEL_RECORDER +desc: confirm to reset settings +eng: "Any Other = No" +new: + +id: LANG_RESET_DONE_SETTING +desc: visual confirmation after settings reset +eng: "Settings" +new: + +id: LANG_RESET_DONE_CLEAR +desc: visual confirmation after settings reset +eng: "Cleared" +new: + +id: LANG_RESET_DONE_CANCEL +desc: Visual confirmation of cancelation +eng: "Canceled" +new: + +id: LANG_CASE_MENU +desc: in fileview_settings_menu() +eng: "Sort Mode" +new: + +id: LANG_SCROLL_MENU +desc: in display_settings_menu() +eng: "Scroll Speed" +new: + +id: LANG_RESET +desc: in system_settings_menu() +eng: "Reset settings" +new: + +id: LANG_PLAYBACK +desc: in settings_menu() +eng: "Playback" +new: + +id: LANG_FILE +desc: in settings_menu() +eng: "File View" +new: + +id: LANG_DISPLAY +desc: in settings_menu() +eng: "Display" +new: + +id: LANG_SYSTEM +desc: in settings_menu() +eng: "System" +new: + +id: LANG_VOLUME +desc: in sound_settings +eng: "Volume" +new: + +id: LANG_BALANCE +desc: in sound_settings +eng: "Balance" +new: + +id: LANG_BASS +desc: in sound_settings +eng: "Bass" +new: + +id: LANG_TREBLE +desc: in sound_settings +eng: "Treble" +new: + +id: LANG_LOUDNESS +desc: in sound_settings +eng: "Loudness" +new: + +id: LANG_BBOOST +desc: in sound settings +eng: "Bass Boost" +new: + +id: LANG_DECAY +desc: in sound_settings +eng: "AV decay time" +new: + +id: LANG_CHANNEL_MENU +desc: in sound_settings +eng: "Channels" +new: + +id: LANG_CHANNEL +desc: in sound_settings +eng: "Channel configuration" +new: + +id: LANG_CHANNEL_STEREO +desc: in sound_settings +eng: "Stereo" +new: + +id: LANG_CHANNEL_MONO +desc: in sound_settings +eng: "Mono" +new: + +id: LANG_CHANNEL_LEFT +desc: in sound_settings +eng: "Mono Left" +new: + +id: LANG_CHANNEL_RIGHT +desc: in sound_settings +eng: "Mono Right" +new: + +id: LANG_AUTOVOL +desc: in sound_settings +eng: "Auto Volume" +new: + +id: LANG_SHOWDIR_ERROR_BUFFER +desc: in showdir(), displayed on screen when you reach buffer limit +eng: "Dir Buffer" +new: + +id: LANG_SHOWDIR_ERROR_FULL +desc: in showdir(), displayed on screen when you reach buffer limit +eng: "is full!" +new: + +id: LANG_RESUME_ASK +desc: question asked at the begining when resume is on +eng: "Resume?" +new: + +id: LANG_RESUME_CONFIRM_PLAYER +desc: posible answers to resume question +eng: "(PLAY/STOP)" +new: + +id: LANG_RESUME_CONFIRM_RECORDER +desc: posible answer to resume question +eng: "Play = Yes" +new: + +id: LANG_RESUME_CANCEL_RECORDER +desc: posible answer to resume question +eng: "Any Other = No" +new: + +id: LANG_KEYLOCK_ON_PLAYER +desc: displayed when key lock is on +eng: "Keylock ON" +new: + +id: LANG_KEYLOCK_OFF_PLAYER +desc: displayed when key lock is turned off +eng: "Keylock OFF" +new: + +id: LANG_KEYLOCK_ON_RECORDER +desc: displayed when key lock is on +eng: "Key lock is ON" +new: + +id: LANG_KEYLOCK_OFF_RECORDER +desc: displayed when key lock is turned off +eng: "Key lock is OFF" +new: + +id: LANG_MUTE_ON_PLAYER +desc: displayed when mute is on +eng: "Mute ON" +new: + +id: LANG_MUTE_OFF_PLAYER +desc: displayed when mute is off +eng: "MUTE OFF" +new: + +id: LANG_MUTE_ON_RECORDER +desc: displayed when mute is on +eng: "Mute is ON" +new: + +id: LANG_MUTE_OFF_RECORDER +desc: displayed when mute is off +eng: "Mute is OFF" +new: + +id: LANG_ID3_INFO +desc: in the browse_id3() function +eng: "-ID3 Info- " +new: + +id: LANG_ID3_SCREEN +desc: in the browse_id3() function +eng: "--Screen-- " +new: + +id: LANG_ID3_TITLE +desc: in wps +eng: "[Title]" +new: + +id: LANG_ID3_NO_TITLE +desc: in wps when no title is avaible +eng: "" +new: + +id: LANG_ID3_ARTIST +desc: in wps +eng: "[Artist]" +new: + +id: LANG_ID3_NO_ARTIST +desc: in wps when no artist is avaible +eng: "" +new: + +id: LANG_ID3_ALBUM +desc: in wps +eng: "[Album]" +new: + +id: LANG_ID3_NO_ALBUM +desc: in wps when no album is avaible +eng: "" +new: + +id: LANG_ID3_TRACKNUM +desc: in wps +eng: "[Tracknum]" +new: + +id: LANG_ID3_NO_TRACKNUM +desc: in wps if no track number is avaible +eng: "" +new: + +id: LANG_ID3_LENGHT +desc: in wps +eng: "[Length]" +new: + +id: LANG_ID3_PLAYLIST +desc: in wps +eng: "[Playlist]" +new: + +id: LANG_ID3_BITRATE +desc: in wps +eng: "[Bitrate]" +new: + +id: LANG_ID3_FRECUENCY +desc: in wps +eng: "[Frecuency]" +new: + +id: LANG_ID3_PATH +desc: in wps +eng: "[PATH]" +new: + +id: LANG_PITCH_UP +desc: in wps +eng: "Pitch up" +new: + +id: LANG_PITCH_DOWN +desc: in wps +eng: "Pitch down" +new: + +id: LANG_PAUSE +desc: in wps +eng: "Pause" +new: + +id: LANG_F2_MODE +desc: in wps F2 pressed +eng: "mode:" +new: + +id: LANG_DIR_FILTER +desc: in wps F2 pressed +eng: "Dir filter: %s" +new: + +id: LANG_F3_STATUS +desc: in wps F3 pressed +eng: "Status" +new: + +id: LANG_F3_SCROLL +desc: in wps F3 pressed +eng: "Scroll" +new: + +id: LANG_F3_BAR +desc: in wps F3 pressed +eng: "bar" +new: + +id: LANG_END_PLAYLIST_PLAYER +desc: when playlist has finished +eng: "End of list" +new: + +id: LANG_END_CONFIRM_PLAYER +desc: when playlist has finished +eng: "" +new: + +id: LANG_END_PLAYLIST_RECORDER +desc: when playlist has finished +eng: "" +new: + +id: LANG_END_CONFIRM_RECORDER +desc: when playlist has finished +eng: "Press ON" +new: + +id: LANG_SNAKE_SCORE +desc: when you die in snake game +eng: "Your score :" +new: + +id: LANG_SNAKE_HISCORE +desc: high score in snake game +eng: "High Score: %d" +new: + +id: LANG_SNAKE_HISCORE_NEW +desc: new high score in snake game +eng: "New High Score!" +new: + +id: LANG_SNAKE_PAUSE +desc: displayed when game is paused +eng: "Game Paused" +new: + +id: LANG_SNAKE_RESUME +desc: what to do to resume game +eng: "[Play] to resume" +new: + +id: LANG_SNAKE_QUIT +desc: how to quit game +eng: "[Off] to quit" +new: + +id: LANG_SNAKE_LEVEL +desc: level of difficulty +eng: "Level - %d" +new: + +id: LANG_SNAKE_RANGE +desc: range of levels +eng: "(1 - slow, 9 - fast)" +new: + +id: LANG_SNAKE_START +desc: how to start or pause the game +eng: "[Play] to start/pause" +new: + +id: LANG_SOKOBAN_LEVEL +desc: must be smaller than 6 characters +eng: "Level" +new: + +id: LANG_SOKOBAN_MOVE +desc: must be smaller than 6 characters +eng: "Moves" +new: + +id: LANG_SOKOBAN_WIN +desc: displayed when you win +eng: "YOU WIN!!" +new: + +id: LANG_SOKOBAN_QUIT +desc: how to quit game +eng: "[Off] to stop" +new: + +id: LANG_SOKOBAN_F1 +desc: what does F1 do +eng: "[F1] - level" +new: + +id: LANG_SOKOBAN_F2 +desc: what does F2 do +eng: "[F2] same level" +new: + +id: LANG_SOKOBAN_F3 +desc: what does F3 do +eng: "[F3] + level" +new: + +# Next ids are for Worlmet Game. +# Lenght restrictions for score board strings (LANG_SB_XXX): +# LCD_PROPFONTS: max 43 pixel +# fix font: max 7 characters + +id: LANG_WORMLET_LENGTH +desc: wormlet game +eng: "Len:%d" +new: + +id: LANG_WORMLET_GROWING +desc: wormlet game +eng: "Growing" +new: + +id: LANG_WORMLET_HUNGRY +desc: wormlet game +eng: "Hungry" +new: + +id: LANG_WORMLET_WORMED +desc: wormlet game +eng: "Wormed" +new: + +id: LANG_WORMLET_ARGH +desc: wormlet game +eng: "Argh" +new: + +id: LANG_WORMLET_CRASHED +desc: wormlet game +eng: "Crashed" +new: + +id: LANG_WORMLET_HIGHSCORE +desc: wormlet game +eng: "Hs: %d" +new: + +# Length restrictions for wormlet config screen strings (LANG_CS_XXX) +# They must fit on the entire screen - preferably with the +# key names aligned right + +id: LANG_WORMLET_PLAYERS +desc: wormlet game +eng: "%d Players up/dn" +new: + +id: LANG_WORMLET_WORMS +desc: wormlet game +eng: "%d Worms l/r" +new: + +id: LANG_WORMLET_REMOTE_CTRL +desc: wormlet game +eng: "Remote control F1" +new: + +id: LANG_WORMLET_NO_REM_CTRL +desc: wormlet game +eng: "No rem. control F1" +new: + +id: LANG_WORMLET_2_KEY_CTRL +desc: wormlet game +eng: "2 key control F1" +new: + +id: LANG_WORMLET_4_KEY_CTRL +desc: wormlet game +eng: "4 key control F1" +new: + +id: LANG_WORMLET_NO_CONTROL +desc: wormlet game +eng: "Out of control" +new: + +# Wormlet game ids ended + +id: LANG_TETRIS_LOSE +desc: tetris game +eng: "You lose!" +new: + +id: LANG_TETRIS_LEVEL +desc: tetris game +eng: "0 Rows - Level 0" +new: diff --git a/apps/main_menu.c b/apps/main_menu.c index 7430671fc0..ad5388ec6f 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -172,19 +172,19 @@ Menu show_info(void) #endif #ifdef HAVE_LCD_CHARCELLS - snprintf(s, sizeof(s), "Batt: %d%%%s", + snprintf(s, sizeof(s), str(LANG_BATTERY_LEVEL_PLAYER), battery_level(), battery_level_safe() ? "" : "!"); lcd_puts(0, 1, s); #else #ifdef HAVE_CHARGE_CTRL if (charger_enabled) - snprintf(s, sizeof(s), "Battery: charging"); + snprintf(s, sizeof(s), str(LANG_BATTERY_CHARGE)); else - snprintf(s, sizeof(s), "Battery: %d%%%s", + snprintf(s, sizeof(s), str(LANG_BATTERY_LEVEL_RECORDER), battery_level(), battery_level_safe() ? "" : " !!"); lcd_puts(0, 3, s); #else - snprintf(s, sizeof(s), "Battery: %d%%%s", + snprintf(s, sizeof(s), str(LANG_BATTERY_LEVEL_RECORDER), battery_level(), battery_level_safe() ? "" : " !!"); lcd_puts(0, 3, s); #endif @@ -224,7 +224,7 @@ Menu main_menu(void) #ifndef SIMULATOR { str(LANG_DEBUG), debug_menu }, #else - { "USB (sim)", simulate_usb }, + { str(LANG_USB), simulate_usb }, #endif }; diff --git a/apps/playlist.c b/apps/playlist.c index 76ce81b51a..b81aed8763 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -35,6 +35,8 @@ #include "widgets.h" #endif +#include "lang.h" + struct playlist_info playlist; #define PLAYLIST_BUFFER_SIZE (AVERAGE_FILENAME_LENGTH*MAX_FILES_IN_DIR) @@ -209,7 +211,7 @@ int play_list(char *dir, /* "current directory" */ /* If file is NULL, the list is in RAM */ if(file) { lcd_clear_display(); - lcd_puts(0,0,"Loading..."); + lcd_puts(0,0,str(LANG_PLAYLIST_LOAD)); status_draw(); lcd_update(); playlist.in_ram = false; @@ -273,7 +275,7 @@ int play_list(char *dir, /* "current directory" */ } if(!playlist.in_ram) { - lcd_puts(0,0,"Playing... "); + lcd_puts(0,0,str(LANG_PLAYLIST_PLAY)); status_draw(); lcd_update(); } @@ -350,8 +352,8 @@ void add_indices_to_playlist(void) close(fd); lcd_clear_display(); - lcd_puts(0,0,"Playlist"); - lcd_puts(0,1,"buffer full"); + lcd_puts(0,0,str(LANG_PLAYINDICES_PLAYLIST)); + lcd_puts(0,1,str(LANG_PLAYINDICES_BUFFER)); lcd_update(); sleep(HZ*2); lcd_clear_display(); @@ -363,7 +365,8 @@ void add_indices_to_playlist(void) if(!playlist.in_ram) { if ( current_tick >= next_tick ) { next_tick = current_tick + HZ; - snprintf(line, sizeof line, "%d files", + snprintf(line, sizeof line, + str(LANG_PLAYINDICES_AMOUNT), playlist.amount); lcd_puts(0,1,line); status_draw(); @@ -380,7 +383,8 @@ void add_indices_to_playlist(void) break; } if(!playlist.in_ram) { - snprintf(line, sizeof line, "%d files", playlist.amount); + snprintf(line, sizeof line, str(LANG_PLAYINDICES_AMOUNT), + playlist.amount); lcd_puts(0,1,line); status_draw(); lcd_update(); diff --git a/apps/recorder/snake.c b/apps/recorder/snake.c index b0e42d8fd0..8c14527bd5 100644 --- a/apps/recorder/snake.c +++ b/apps/recorder/snake.c @@ -20,7 +20,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left; #include "button.h" #include "kernel.h" #include "menu.h" - +#include "lang.h" int board[28][16],snakelength; unsigned int score,hiscore=0; @@ -35,14 +35,14 @@ void die (void) { lcd_clear_display(); snprintf(pscore,sizeof(pscore),"%d",score); lcd_putsxy(3,12,"oops...",0); - lcd_putsxy(3,22,"Your Score :",0); + lcd_putsxy(3,22,str(LANG_SNAKE_SCORE),0); lcd_putsxy(3,32, pscore,0); if (score>hiscore) { hiscore=score; - lcd_putsxy(3,42,"New High Score!",0); + lcd_putsxy(3,42,str(LANG_SNAKE_HISCORE_NEW),0); } else { - snprintf(hscore,sizeof(hscore),"High Score %d",hiscore); + snprintf(hscore,sizeof(hscore),str(LANG_SNAKE_HISCORE),hiscore); lcd_putsxy(3,42,hscore,0); } lcd_update(); @@ -141,9 +141,9 @@ void redraw (void) { void game_pause (void) { lcd_clear_display(); - lcd_putsxy(3,12,"Game Paused",0); - lcd_putsxy(3,22,"[play] to resume",0); - lcd_putsxy(3,32,"[off] to quit",0); + lcd_putsxy(3,12,str(LANG_SNAKE_PAUSE),0); + lcd_putsxy(3,22,str(LANG_SNAKE_RESUME),0); + lcd_putsxy(3,32,str(LANG_SNAKE_QUIT),0); lcd_update(); while (1) { switch (button_get(true)) { @@ -221,12 +221,12 @@ void game_init(void) { lcd_clear_display(); - snprintf(plevel,sizeof(plevel),"Level - %d",level); - snprintf(phscore,sizeof(phscore),"High Score - %d",hiscore); + snprintf(plevel,sizeof(plevel),str(LANG_SNAKE_LEVEL),level); + snprintf(phscore,sizeof(phscore),str(LANG_SNAKE_HISCORE),hiscore); lcd_putsxy(3,2, plevel,0); - lcd_putsxy(3,12, "(1 - slow, 9 - fast)",0); - lcd_putsxy(3,22, "[off] to quit",0); - lcd_putsxy(3,32, "[play] to start/pause",0); + lcd_putsxy(3,12, str(LANG_SNAKE_RANGE),0); + lcd_putsxy(3,22, str(LANG_SNAKE_QUIT),0); + lcd_putsxy(3,32, str(LANG_SNAKE_START),0); lcd_putsxy(3,42, phscore,0); lcd_update(); @@ -250,7 +250,7 @@ void game_init(void) { return; break; } - snprintf(plevel,sizeof(plevel),"Level - %d",level); + snprintf(plevel,sizeof(plevel),str(LANG_SNAKE_LEVEL),level); lcd_putsxy(3,2, plevel,0); lcd_update(); } diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c index 078153077e..bec556054a 100644 --- a/apps/recorder/sokoban.c +++ b/apps/recorder/sokoban.c @@ -32,7 +32,7 @@ #include #endif #include - +#include "lang.h" #define SOKOBAN_TITLE "Sokoban" #define SOKOBAN_TITLE_FONT 2 #define NUM_LEVELS sizeof(levels)/320 @@ -1847,8 +1847,8 @@ void update_screen(void) { lcd_drawrect (80,0,32,32); lcd_drawrect (80,32,32,64); - lcd_putsxy (81, 10, "Level", 0); - lcd_putsxy (81, 42, "Moves", 0); + lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL), 0); + lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE), 0); /* print out the screen */ lcd_update(); } @@ -2187,7 +2187,7 @@ void sokoban_loop(void) { if (current_level == NUM_LEVELS) { for(ii=0; ii<30 ; ii++) { lcd_clear_display(); - lcd_putsxy(10, 20, "YOU WIN!!", 2); + lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN), 2); lcd_update(); lcd_invertrect(0,0,111,63); lcd_update(); @@ -2232,10 +2232,10 @@ Menu sokoban(void) lcd_clear_display(); - lcd_putsxy( 3,12, "[Off] to stop", 0); - lcd_putsxy( 3,22, "[F1] - level",0); - lcd_putsxy( 3,32, "[F2] same level",0); - lcd_putsxy( 3,42, "[F3] + level",0); + lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT), 0); + lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1),0); + lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2),0); + lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3),0); lcd_update(); sleep(HZ*2); diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c index ba7ff546f7..2455f269b3 100644 --- a/apps/recorder/tetris.c +++ b/apps/recorder/tetris.c @@ -35,7 +35,7 @@ #include #endif #include "sprintf.h" - +#include "lang.h" #define TETRIS_TITLE "Tetris!" #define TETRIS_TITLE_FONT 1 #define TETRIS_TITLE_XLOC 43 @@ -366,7 +366,7 @@ void game_loop(void) if(gameover()) { lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52); - lcd_putsxy (2, 52, "You lose!", 0); + lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE), 0); lcd_update(); sleep(HZ * 3); return; @@ -396,7 +396,7 @@ Menu tetris(void) init_tetris(); draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y); - lcd_putsxy (2, 42, "0 Rows - Level 0", 0); + lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL), 0); lcd_update(); next_b = t_rand(blocks); diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c index 71a356134f..acebbad8bf 100644 --- a/apps/recorder/wormlet.c +++ b/apps/recorder/wormlet.c @@ -33,36 +33,7 @@ #include "kernel.h" #include "menu.h" #include "rtc.h" - -/* I extracted string constants for output to - simplify inernationalization - once we have - decided how to do that exactly. Even though - there are other strings in the code they don't - have to be internationalized because they are - only for debugging purposes and are only included - if DEBUG_WORMLET is defined anyway.*/ - -/* Length restriction for score board strings (LANG_SB_XXX): - LCD_PROPFONTS: max 43 pixel - fix font: max 7 characters*/ -#define LANG_SB_LENGTH "Len:%d" -#define LANG_SB_GROWING "Growing" -#define LANG_SB_HUNGRY "Hungry" -#define LANG_SB_WORMED "Wormed" -#define LANG_SB_ARGH "Argh" -#define LANG_SB_CRASHED "Crashed" -#define LANG_SB_HIGHSCORE "Hs: %d" - -/* Length restriction for config screen strings (LANG_CS_XXX): - The must fit on the entire screen - preferably - with the key names aligned right. */ -#define LANG_CS_PLAYERS "%d Players up/dn" -#define LANG_CS_WORMS "%d Worms l/r" -#define LANG_CS_REMOTE_CTRL "Remote control F1" -#define LANG_CS_NO_REM_CTRL "No rem. control F1" -#define LANG_CS_2_KEY_CTRL "2 key control F1" -#define LANG_CS_4_KEY_CTRL "4 key control F1" -#define LANG_CS_NO_CONTROL "Out of control" +#include "lang.h" /* size of the field the worm lives in */ #define FIELD_RECT_X 1 @@ -1208,37 +1179,37 @@ static void score_board(void) } /* length */ - snprintf(buf, sizeof (buf), LANG_SB_LENGTH, score); + snprintf(buf, sizeof (buf),str(LANG_WORMLET_LENGTH), score); /* worm state */ switch (check_collision(&worms[i])) { case COLLISION_NONE: if (worms[i].growing > 0){ - snprintf(buf2, sizeof(buf2), LANG_SB_GROWING); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_GROWING)); } else { if (worms[i].alive) { - snprintf(buf2, sizeof(buf2), LANG_SB_HUNGRY); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_HUNGRY)); } else { - snprintf(buf2, sizeof(buf2), LANG_SB_WORMED); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_WORMED)); } } break; case COLLISION_WORM: - snprintf(buf2, sizeof(buf2), LANG_SB_WORMED); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_WORMED)); break; case COLLISION_FOOD: - snprintf(buf2, sizeof(buf2), LANG_SB_GROWING); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_GROWING)); break; case COLLISION_ARGH: - snprintf(buf2, sizeof(buf2), LANG_SB_ARGH); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_ARGH)); break; case COLLISION_FIELD: - snprintf(buf2, sizeof(buf2), LANG_SB_CRASHED); + snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED)); break; } lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0); @@ -1250,7 +1221,7 @@ static void score_board(void) } y += 19; } - snprintf(buf , sizeof(buf), LANG_SB_HIGHSCORE, highscore); + snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore); #ifndef DEBUG_WORMLET lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0); #else @@ -1937,29 +1908,29 @@ Menu wormlet(void) lcd_clear_display(); /* first line players */ - snprintf(buf, sizeof buf, LANG_CS_PLAYERS, players); + snprintf(buf, sizeof buf, str(LANG_WORMLET_PLAYERS), players); lcd_puts(0, 0, buf); /* second line worms */ - snprintf(buf, sizeof buf, LANG_CS_WORMS, worm_count); + snprintf(buf, sizeof buf, str(LANG_WORMLET_WORMS), worm_count); lcd_puts(0, 1, buf); /* third line control */ if (players > 1) { if (use_remote) { - snprintf(buf, sizeof buf, LANG_CS_REMOTE_CTRL); + snprintf(buf, sizeof buf, str(LANG_WORMLET_REMOTE_CTRL)); } else { - snprintf(buf, sizeof buf, LANG_CS_NO_REM_CTRL); + snprintf(buf, sizeof buf, str(LANG_WORMLET_NO_REM_CTRL)); } } else { if (players > 0) { if (use_remote) { - snprintf(buf, sizeof buf, LANG_CS_2_KEY_CTRL); + snprintf(buf, sizeof buf, str(LANG_WORMLET_2_KEY_CTRL)); } else { - snprintf(buf, sizeof buf, LANG_CS_4_KEY_CTRL); + snprintf(buf, sizeof buf, str(LANG_WORMLET_4_KEY_CTRL)); } } else { - snprintf(buf, sizeof buf, LANG_CS_NO_CONTROL); + snprintf(buf, sizeof buf, str(LANG_WORMLET_NO_CONTROL)); } } lcd_puts(0, 2, buf); diff --git a/apps/settings.c b/apps/settings.c index 76b0cc5088..3bc39ed6d2 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -43,6 +43,8 @@ #include "font.h" #endif +#include "lang.h" + struct user_settings global_settings; char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */ @@ -304,11 +306,11 @@ int settings_save( void ) { lcd_clear_display(); #ifdef HAVE_LCD_CHARCELLS - lcd_puts(0, 0, "Save failed"); - lcd_puts(0, 1, "Batt. low?"); + lcd_puts(0, 0, str(LANG_SETTINGS_SAVE_PLAYER)); + lcd_puts(0, 1, str(LANG_SETTINGS_BATTERY_PLAYER)); #else - lcd_puts(4, 2, "Save failed"); - lcd_puts(2, 4, "Is battery low?"); + lcd_puts(4, 2, str(LANG_SETTINGS_SAVE_RECORDER)); + lcd_puts(2, 4, str(LANG_SETTINGS_BATTERY_RECORDER)); lcd_update(); #endif sleep(HZ*2); @@ -944,8 +946,8 @@ void set_time(char* string, int timedate[]) cursor[cursorpos][INDEX_WIDTH], line_height); - lcd_puts(0, 4, "ON to set"); - lcd_puts(0, 5, "OFF to revert"); + lcd_puts(0, 4, str(LANG_TIME_SET)); + lcd_puts(0, 5, str(LANG_TIME_REVERT)); #ifdef HAVE_LCD_BITMAP status_draw(); #endif diff --git a/apps/settings_menu.c b/apps/settings_menu.c index d40263cd00..678eda437e 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -36,17 +36,18 @@ #include "powermgmt.h" #include "rtc.h" #include "ata.h" +#include "lang.h" static Menu show_hidden_files(void) { - set_bool_options( "Hidden Files", &global_settings.show_hidden_files, - "show", "hide" ); + set_bool_options( str(LANG_HIDDEN), &global_settings.show_hidden_files, + str(LANG_HIDDEN_SHOW), str(LANG_HIDDEN_HIDE) ); return MENU_OK; } static Menu contrast(void) { - set_int( "Contrast", "", &global_settings.contrast, + set_int( str(LANG_CONTRAST), "", &global_settings.contrast, lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING ); return MENU_OK; } @@ -54,50 +55,53 @@ static Menu contrast(void) #ifndef HAVE_RECORDER_KEYPAD static Menu shuffle(void) { - set_bool( "Shuffle", &global_settings.playlist_shuffle ); + set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle ); return MENU_OK; } #endif static Menu play_selected(void) { - set_bool( "Play Selected", &global_settings.play_selected ); + set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected ); return MENU_OK; } static Menu mp3_filter(void) { - set_bool( "Music Filter", &global_settings.mp3filter ); + set_bool( str(LANG_MP3FILTER), &global_settings.mp3filter ); return MENU_OK; } static Menu sort_case(void) { - set_bool( "Sort Case Sensitive", &global_settings.sort_case ); + set_bool( str(LANG_SORT_CASE), &global_settings.sort_case ); return MENU_OK; } static Menu resume(void) { - char* names[] = { "off", "ask", "on" }; - set_option( "Resume", &global_settings.resume, names, 3, NULL ); + char* names[] = { str(LANG_OFF), + str(LANG_RESUME_SETTING_ASK), + str(LANG_ON) }; + set_option( str(LANG_RESUME), &global_settings.resume, names, 3, NULL ); return MENU_OK; } static Menu backlight_timer(void) { - char* names[] = { "off", "on ", + char* names[] = { str(LANG_OFF), str(LANG_ON), "1s ", "2s ", "3s ", "4s ", "5s ", "6s ", "7s ", "8s ", "9s ", "10s", "15s", "20s", "25s", "30s", "45s", "60s", "90s"}; - set_option("Backlight", &global_settings.backlight, names, 19, backlight_time ); + set_option(str(LANG_BACKLIGHT), &global_settings.backlight, names, 19, + backlight_time ); return MENU_OK; } static Menu scroll_speed(void) { - set_int("Scroll Speed Setting Example", "", &global_settings.scroll_speed, + set_int(str(LANG_SCROLL), "", &global_settings.scroll_speed, &lcd_scroll_speed, 1, 1, 30 ); return MENU_OK; } @@ -105,7 +109,7 @@ static Menu scroll_speed(void) #ifdef HAVE_CHARGE_CTRL static Menu deep_discharge(void) { - set_bool( "Deep Discharge", &global_settings.discharge ); + set_bool( str(LANG_DISCHARGE), &global_settings.discharge ); charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI; return MENU_OK; @@ -139,7 +143,7 @@ static Menu timedate_set(void) timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); - set_time("Set time/date",timedate); + set_time(str(LANG_TIME),timedate); if(timedate[0] != -1) { /* hour */ @@ -155,14 +159,14 @@ static Menu timedate_set(void) /* day */ timedate[5] = ((timedate[5]/10) << 4 | timedate[5]%10) & 0x3f; - rtc_write(0x03, timedate[0] | (rtc_read(0x03) & 0xc0)); /* hour */ - rtc_write(0x02, timedate[1] | (rtc_read(0x02) & 0x80)); /* minute */ - rtc_write(0x01, timedate[2] | (rtc_read(0x01) & 0x80)); /* second */ - rtc_write(0x07, timedate[3]); /* year */ - rtc_write(0x06, timedate[4] | (rtc_read(0x06) & 0xe0)); /* month */ - rtc_write(0x05, timedate[5] | (rtc_read(0x05) & 0xc0)); /* day */ - rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */ - rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ + rtc_write(0x03, timedate[0] | (rtc_read(0x03) & 0xc0)); /* hour */ + rtc_write(0x02, timedate[1] | (rtc_read(0x02) & 0x80)); /* minute */ + rtc_write(0x01, timedate[2] | (rtc_read(0x01) & 0x80)); /* second */ + rtc_write(0x07, timedate[3]); /* year */ + rtc_write(0x06, timedate[4] | (rtc_read(0x06) & 0xe0)); /* month */ + rtc_write(0x05, timedate[5] | (rtc_read(0x05) & 0xc0)); /* day */ + rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */ + rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ } return MENU_OK; } @@ -170,7 +174,7 @@ static Menu timedate_set(void) static Menu spindown(void) { - set_int("Disk Spindown", "s", &global_settings.disk_spindown, + set_int(str(LANG_SPINDOWN), "s", &global_settings.disk_spindown, ata_spindown, 1, 3, 254 ); return MENU_OK; } @@ -181,25 +185,25 @@ static Menu ff_rewind_min_step(void) "5s", "6s", "8s", "10s", "15s", "20s", "25s", "30s", "45s", "60s" }; - set_option("FF/RW Min Step", &global_settings.ff_rewind_min_step, + set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step, names, 14, NULL ); return MENU_OK; } static Menu ff_rewind_accel(void) { - char* names[] = { "off", "2x/1s", "2x/2s", "2x/3s", + char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s", "2x/4s", "2x/5s", "2x/6s", "2x/7s", "2x/8s", "2x/9s", "2x/10s", "2x/11s", "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; - set_option("FF/RW Accel", &global_settings.ff_rewind_accel, + set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel, names, 16, NULL ); return MENU_OK; } static Menu browse_current(void) { - set_bool( "Follow Playlist", &global_settings.browse_current ); + set_bool( str(LANG_FOLLOW), &global_settings.browse_current ); return MENU_OK; } @@ -210,13 +214,14 @@ Menu playback_settings_menu(void) struct menu_items items[] = { #ifndef HAVE_RECORDER_KEYPAD - { "Shuffle", shuffle }, + { str(LANG_SHUFFLE), shuffle }, #endif - { "Play Selected", play_selected }, - { "Resume", resume }, - { "FF/RW Min Step", ff_rewind_min_step }, - { "FF/RW Accel", ff_rewind_accel }, + { str(LANG_PLAY_SELECTED), play_selected }, + { str(LANG_RESUME), resume }, + { str(LANG_FFRW_STEP), ff_rewind_min_step }, + { str(LANG_FFRW_ACCEL), ff_rewind_accel }, }; + bool old_shuffle = global_settings.playlist_shuffle; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); @@ -243,26 +248,26 @@ static Menu reset_settings(void) lcd_clear_display(); #ifdef HAVE_LCD_CHARCELLS - lcd_puts(0,0,"Really?"); - lcd_puts(0,1,"Play/Stop"); + lcd_puts(0,0,str(LANG_RESET_ASK_PLAYER)); + lcd_puts(0,1,str(LANG_RESET_CONFIRM_PLAYER)); #else - lcd_puts(0,0,"Are you sure?"); - lcd_puts(0,1,"Play = Yes"); - lcd_puts(0,2,"Any Other = No"); + lcd_puts(0,0,str(LANG_RESET_ASK_RECORDER)); + lcd_puts(0,1,str(LANG_RESET_CONFIRM_RECORDER)); + lcd_puts(0,2,str(LANG_RESET_CANCEL_RECORDER)); #endif lcd_update(); button = button_get(true); if (button == BUTTON_PLAY) { settings_reset(); lcd_clear_display(); - lcd_puts(0,0,"Settings"); - lcd_puts(0,1,"Cleared"); + lcd_puts(0,0,str(LANG_RESET_DONE_SETTING)); + lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR)); lcd_update(); sleep(HZ); return(true); } else { lcd_clear_display(); - lcd_puts(0,0,"Canceled"); + lcd_puts(0,0,str(LANG_RESET_DONE_CANCEL)); lcd_update(); sleep(HZ); return(false); @@ -275,10 +280,10 @@ static Menu fileview_settings_menu(void) Menu result; struct menu_items items[] = { - { "Sort Mode", sort_case }, - { "Music Filter", mp3_filter }, - { "Hidden Files", show_hidden_files }, - { "Follow Playlist", browse_current }, + { str(LANG_CASE_MENU), sort_case }, + { str(LANG_MP3FILTER), mp3_filter }, + { str(LANG_HIDDEN), show_hidden_files }, + { str(LANG_FOLLOW), browse_current }, }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); @@ -293,9 +298,9 @@ static Menu display_settings_menu(void) Menu result; struct menu_items items[] = { - { "Scroll Speed", scroll_speed }, - { "Backlight", backlight_timer }, - { "Contrast", contrast }, + { str(LANG_SCROLL_MENU), scroll_speed }, + { str(LANG_BACKLIGHT), backlight_timer }, + { str(LANG_CONTRAST), contrast }, }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); @@ -310,14 +315,14 @@ static Menu system_settings_menu(void) Menu result; struct menu_items items[] = { - { "Disk Spindown", spindown }, + { str(LANG_SPINDOWN), spindown }, #ifdef HAVE_CHARGE_CTRL - { "Deep Discharge", deep_discharge }, + { str(LANG_DISCHARGE), deep_discharge }, #endif #ifdef HAVE_RTC - { "Time/Date", timedate_set }, + { str(LANG_TIME), timedate_set }, #endif - { "Reset settings", reset_settings }, + { str(LANG_RESET), reset_settings }, }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); @@ -332,10 +337,10 @@ Menu settings_menu(void) Menu result; struct menu_items items[] = { - { "Playback", playback_settings_menu }, - { "File View", fileview_settings_menu }, - { "Display", display_settings_menu }, - { "System", system_settings_menu }, + { str(LANG_PLAYBACK), playback_settings_menu }, + { str(LANG_FILE), fileview_settings_menu }, + { str(LANG_DISPLAY), display_settings_menu }, + { str(LANG_SYSTEM), system_settings_menu }, }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 664ad0b9fb..c7d72cf553 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c @@ -29,6 +29,7 @@ #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif +#include "lang.h" static char *fmt[] = { @@ -147,38 +148,38 @@ void set_sound(char* string, static Menu volume(void) { - set_sound("Volume", &global_settings.volume, SOUND_VOLUME); + set_sound(str(LANG_VOLUME), &global_settings.volume, SOUND_VOLUME); return MENU_OK; } static Menu balance(void) { - set_sound("Balance", &global_settings.balance, SOUND_BALANCE); + set_sound(str(LANG_BALANCE), &global_settings.balance, SOUND_BALANCE); return MENU_OK; } static Menu bass(void) { - set_sound("Bass", &global_settings.bass, SOUND_BASS); + set_sound(str(LANG_BASS), &global_settings.bass, SOUND_BASS); return MENU_OK; }; static Menu treble(void) { - set_sound("Treble", &global_settings.treble, SOUND_TREBLE); + set_sound(str(LANG_TREBLE), &global_settings.treble, SOUND_TREBLE); return MENU_OK; } #ifdef HAVE_MAS3587F static Menu loudness(void) { - set_sound("Loudness", &global_settings.loudness, SOUND_LOUDNESS); + set_sound(str(LANG_LOUDNESS), &global_settings.loudness, SOUND_LOUDNESS); return MENU_OK; }; static Menu bass_boost(void) { - set_sound("Bass boost", &global_settings.bass_boost, SOUND_SUPERBASS); + set_sound(str(LANG_BBOOST), &global_settings.bass_boost, SOUND_SUPERBASS); return MENU_OK; }; @@ -189,8 +190,8 @@ static void set_avc(int val) static Menu avc(void) { - char* names[] = { "off", "2s", "4s", "8s" }; - set_option("AV decay time", &global_settings.avc, names, 4, set_avc ); + char* names[] = { str(LANG_OFF), "2s", "4s", "8s" }; + set_option(str(LANG_DECAY), &global_settings.avc, names, 4, set_avc ); return MENU_OK; } #endif /* ARCHOS_RECORDER */ @@ -202,8 +203,9 @@ static void set_chanconf(int val) static Menu chanconf(void) { - char *names[] = {"Stereo", "Mono", "Mono Left", "Mono Right" }; - set_option("Channel configuration", + char *names[] = {str(LANG_CHANNEL_STEREO), str(LANG_CHANNEL_MONO), + str(LANG_CHANNEL_LEFT),str(LANG_CHANNEL_RIGHT) }; + set_option(str(LANG_CHANNEL), &global_settings.channel_config, names, 4, set_chanconf ); return MENU_OK; } @@ -213,15 +215,15 @@ Menu sound_menu(void) int m; Menu result; struct menu_items items[] = { - { "Volume", volume }, - { "Bass", bass }, - { "Treble", treble }, - { "Balance", balance }, - { "Channels", chanconf }, + { str(LANG_VOLUME), volume }, + { str(LANG_BASS), bass }, + { str(LANG_TREBLE), treble }, + { str(LANG_BALANCE), balance }, + { str(LANG_CHANNEL_MENU), chanconf }, #ifdef HAVE_MAS3587F - { "Loudness", loudness }, - { "Bass Boost", bass_boost }, - { "Auto Volume", avc } + { str(LANG_LOUDNESS), loudness }, + { str(LANG_BBOOST), bass_boost }, + { str(LANG_AUTOVOL), avc } #endif }; diff --git a/apps/tree.c b/apps/tree.c index b86f606cc6..40d686490a 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -45,6 +45,7 @@ #include "ata.h" #include "rolo.h" #include "icons.h" +#include "lang.h" #ifdef HAVE_LCD_BITMAP #include "widgets.h" @@ -289,8 +290,8 @@ static int showdir(char *path, int start) lcd_double_height(false); #endif lcd_clear_display(); - lcd_puts(0,0,"Dir buffer"); - lcd_puts(0,1,"is full!"); + lcd_puts(0,0,str(LANG_SHOWDIR_ERROR_BUFFER)); + lcd_puts(0,1,str(LANG_SHOWDIR_ERROR_FULL)); lcd_update(); sleep(HZ*2); lcd_clear_display(); @@ -420,12 +421,12 @@ bool ask_resume(void) return true; lcd_clear_display(); - lcd_puts(0,0,"Resume?"); + lcd_puts(0,0,str(LANG_RESUME_ASK)); #ifdef HAVE_LCD_CHARCELLS - lcd_puts(0,1,"(Play/Stop)"); + lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); #else - lcd_puts(0,1,"Play = Yes"); - lcd_puts(0,2,"Any other = No"); + lcd_puts(0,1,str(LANG_RESUME_CONFIRM_RECORDER)); + lcd_puts(0,2,str(LANG_RESUME_CANCEL_RECORDER)); #endif lcd_update(); if (button_get(true) == BUTTON_PLAY) diff --git a/apps/wps-display.c b/apps/wps-display.c index 8d33c723a4..72905e441b 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -37,7 +37,7 @@ #include "status.h" #include "wps-display.h" #include "debug.h" - +#include "lang.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" #include "widgets.h" @@ -579,11 +579,11 @@ void wps_display(struct mp3entry* id3) if (!id3 && !mpeg_is_playing()) { #ifdef HAVE_LCD_CHARCELLS - lcd_puts(0, 0, "End of list"); - lcd_puts(0, 1, ""); + lcd_puts(0, 0, str(LANG_END_PLAYLIST_PLAYER)); + lcd_puts(0, 1, str(LANG_END_CONFIRM_PLAYER)); #else - lcd_puts(0, 2, ""); - lcd_puts(5, 4, "Press ON"); + lcd_puts(0, 2, str(LANG_END_PLAYLIST_RECORDER)); + lcd_puts(5, 4, str(LANG_END_CONFIRM_RECORDER)); #endif } else diff --git a/apps/wps.c b/apps/wps.c index c912cdd9b0..8f093f8a0a 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -40,7 +40,7 @@ #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif - +#include "lang.h" #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ @@ -116,17 +116,17 @@ void display_keylock_text(bool locked) #ifdef HAVE_LCD_CHARCELLS if(locked) - lcd_puts(0, 0, "Keylock ON"); + lcd_puts(0, 0, str(LANG_KEYLOCK_ON_PLAYER)); else - lcd_puts(0, 0, "Keylock OFF"); + lcd_puts(0, 0, str(LANG_KEYLOCK_OFF_PLAYER)); #else if(locked) { - lcd_puts(2, 3, "Key lock is ON"); + lcd_puts(2, 3, str(LANG_KEYLOCK_ON_RECORDER)); } else { - lcd_puts(2, 3, "Key lock is OFF"); + lcd_puts(2, 3, str(LANG_KEYLOCK_OFF_RECORDER)); } lcd_update(); #endif @@ -141,17 +141,17 @@ void display_mute_text(bool muted) #ifdef HAVE_LCD_CHARCELLS if (muted) - lcd_puts(0, 0, "Mute ON"); + lcd_puts(0, 0, str(LANG_MUTE_ON_PLAYER)); else - lcd_puts(0, 0, "Mute OFF"); + lcd_puts(0, 0, str(LANG_MUTE_OFF_PLAYER)); #else if (muted) { - lcd_puts(2, 3, "Mute is ON"); + lcd_puts(2, 3, str(LANG_MUTE_ON_RECORDER)); } else { - lcd_puts(2, 3, "Mute is OFF"); + lcd_puts(2, 3, str(LANG_MUTE_OFF_RECORDER)); } lcd_update(); #endif @@ -185,8 +185,8 @@ static int browse_id3(void) lcd_stop_scroll(); lcd_clear_display(); - lcd_puts(0, 0, "-ID3 Info- "); - lcd_puts(0, 1, "--Screen-- "); + lcd_puts(0, 0, str(LANG_ID3_INFO)); + lcd_puts(0, 1, str(LANG_ID3_SCREEN)); lcd_update(); sleep(HZ); @@ -198,23 +198,26 @@ static int browse_id3(void) switch (menu_pos) { case 0: - lcd_puts(0, 0, "[Title]"); - lcd_puts_scroll(0, 1, id3->title ? id3->title : ""); + lcd_puts(0, 0, str(LANG_ID3_TITLE)); + lcd_puts_scroll(0, 1, id3->title ? id3->title : + (char*)str(LANG_ID3_NO_TITLE)); break; case 1: - lcd_puts(0, 0, "[Artist]"); + lcd_puts(0, 0, str(LANG_ID3_ARTIST)); lcd_puts_scroll(0, 1, - id3->artist ? id3->artist : ""); + id3->artist ? id3->artist : + (char*)str(LANG_ID3_NO_ARTIST)); break; case 2: - lcd_puts(0, 0, "[Album]"); - lcd_puts_scroll(0, 1, id3->album ? id3->album : ""); + lcd_puts(0, 0, str(LANG_ID3_ALBUM)); + lcd_puts_scroll(0, 1, id3->album ? id3->album : + (char*)str(LANG_ID3_NO_ALBUM)); break; case 3: - lcd_puts(0, 0, "[Tracknum]"); + lcd_puts(0, 0, str(LANG_ID3_TRACKNUM)); if (id3->tracknum) { @@ -224,12 +227,12 @@ static int browse_id3(void) } else { - lcd_puts_scroll(0, 1, ""); + lcd_puts_scroll(0, 1, str(LANG_ID3_NO_TRACKNUM)); } break; case 4: - lcd_puts(0, 0, "[Length]"); + lcd_puts(0, 0, str(LANG_ID3_LENGHT)); snprintf(scroll_text,sizeof(scroll_text), "%d:%02d", id3->length / 60000, id3->length % 60000 / 1000 ); @@ -237,7 +240,7 @@ static int browse_id3(void) break; case 5: - lcd_puts(0, 0, "[Playlist]"); + lcd_puts(0, 0, str(LANG_ID3_PLAYLIST)); snprintf(scroll_text,sizeof(scroll_text), "%d/%d", id3->index + 1, playlist.amount); lcd_puts_scroll(0, 1, scroll_text); @@ -245,21 +248,21 @@ static int browse_id3(void) case 6: - lcd_puts(0, 0, "[Bitrate]"); + lcd_puts(0, 0, str(LANG_ID3_BITRATE)); snprintf(scroll_text,sizeof(scroll_text), "%d kbps", id3->bitrate); lcd_puts(0, 1, scroll_text); break; case 7: - lcd_puts(0, 0, "[Frequency]"); + lcd_puts(0, 0, str(LANG_ID3_FRECUENCY)); snprintf(scroll_text,sizeof(scroll_text), "%d Hz", id3->frequency); lcd_puts(0, 1, scroll_text); break; case 8: - lcd_puts(0, 0, "[Path]"); + lcd_puts(0, 0, str(LANG_ID3_PATH)); lcd_puts_scroll(0, 1, id3->path); break; } @@ -644,7 +647,7 @@ int on_screen(void) lcd_scroll_pause(); lcd_clear_display(); - ptr = "Pitch up"; + ptr = str(LANG_PITCH_UP); lcd_getstringsize(ptr,FONT_UI,&w,&h); lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr, FONT_UI); lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow], @@ -654,13 +657,13 @@ int on_screen(void) lcd_getstringsize(buf,FONT_UI,&w,&h); lcd_putsxy((LCD_WIDTH-w)/2, h, buf, FONT_UI); - ptr = "Pitch down"; + ptr = str(LANG_PITCH_DOWN); lcd_getstringsize(ptr,FONT_UI,&w,&h); lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr, FONT_UI); lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); - ptr = "Pause"; + ptr = str(LANG_PAUSE); lcd_getstringsize(ptr,FONT_UI,&w,&h); lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr, FONT_UI); lcd_bitmap(bitmap_icons_7x8[Icon_Pause], @@ -753,15 +756,15 @@ bool f2_screen(void) while (!exit) { lcd_clear_display(); - lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Shuffle", FONT_UI); - lcd_putsxy(0, LCD_HEIGHT/2 - h, "mode:", FONT_UI); + lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE), FONT_UI); + lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE), FONT_UI); lcd_putsxy(0, LCD_HEIGHT/2, - global_settings.playlist_shuffle ? "on" : "off", FONT_UI); + global_settings.playlist_shuffle ? str(LANG_ON) : str(LANG_OFF), FONT_UI); lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); - snprintf(buf, sizeof buf, "Dir filter: %s", - global_settings.mp3filter ? "on" : "off"); + snprintf(buf, sizeof buf, str(LANG_DIR_FILTER), + global_settings.mp3filter ? str(LANG_ON) : str(LANG_OFF)); /* Get the string width and height */ lcd_getstringsize(buf,FONT_UI,&w,&h); @@ -819,21 +822,21 @@ bool f3_screen(void) int w,h; char* ptr; - ptr = "Status"; + ptr = str(LANG_F3_STATUS); lcd_getstringsize(ptr,FONT_UI,&w,&h); lcd_clear_display(); - lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Scroll", FONT_UI); - lcd_putsxy(0, LCD_HEIGHT/2 - h, "bar:", FONT_UI); + lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL), FONT_UI); + lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR), FONT_UI); lcd_putsxy(0, LCD_HEIGHT/2, - global_settings.scrollbar ? "on" : "off", FONT_UI); + global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF), FONT_UI); lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, FONT_UI); - lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, "bar:", FONT_UI); + lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR), FONT_UI); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, - global_settings.statusbar ? "on" : "off", FONT_UI); + global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF), FONT_UI); lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); lcd_update(); diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile index c3a585e64e..c852088588 100644 --- a/uisimulator/win32/Makefile +++ b/uisimulator/win32/Makefile @@ -40,6 +40,7 @@ DEBUG = -g # where to put all output files OBJDIR = . +LANGUAGE = english TARGET = $(OBJDIR)/uisw32.exe @@ -49,7 +50,7 @@ $(KEYPAD) $(DISPLAY) -DAPPSVERSION=\"$(VERSION)\" LDFLAGS = -lgdi32 -luser32 -mwindows # Use this for simulator-only files -INCLUDES = -I. -I$(DRIVERS) -I$(COMMON) -I$(FIRMWAREDIR) -I$(APPDIR) -I$(MACHINEDIR) -I../common -I$(MACHINEDIR) +INCLUDES = -I. -I$(DRIVERS) -I$(COMMON) -I$(FIRMWAREDIR) -I$(APPDIR) -I$(MACHINEDIR) -I../common -I$(MACHINEDIR) -I$(OBJDIR) # The true Rockbox Applications should use this include path: APPINCLUDES = -I$(FIRMWAREDIR)/include $(INCLUDES) @@ -64,8 +65,7 @@ FIRMSRCS = lcd.c power.c sprintf.c id3.c usb.c \ mpeg.c powermgmt.c font.c loadfont.c X5x8.c APPS = main.c tree.c menu.c credits.c main_menu.c icons.c \ - playlist.c showtext.c wps.c wps-display.c settings.c status.c \ - lang.c + playlist.c showtext.c wps.c wps-display.c settings.c status.c MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c @@ -78,7 +78,7 @@ SRCS = button.c dir-win32.c lcd-win32.c panic-win32.c thread-win32.c \ debug-win32.c kernel.c string-win32.c uisw32.c stubs.c \ $(APPS) $(MENUS) $(FIRMSRCS) strtok.c sim_icons.c -OBJS := $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o +OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o all: $(TARGET) @@ -161,8 +161,9 @@ $(OBJDIR)/playlist.o: $(APPDIR)/playlist.c $(OBJDIR)/showtext.o: $(APPDIR)/showtext.c $(CC) $(APPCFLAGS) -c $< -o $@ -$(OBJDIR)/lang.o: $(APPDIR)/lang.c - $(CC) $(APPCFLAGS) -c $< -o $@ +$(OBJDIR)/lang.o: $(APPDIR)/lang/$(LANGUAGE).lang + $(TOOLSDIR)/genlang -p=$(OBJDIR)/lang $< + $(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@ $(OBJDIR)/lcd.o: $(DRIVERS)/lcd.c $(CC) $(APPCFLAGS) -c $< -o $@ diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index 2f74394d1f..821e13553f 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile @@ -42,6 +42,7 @@ DEBUG = -g OBJDIR = . TARGET = $(OBJDIR)/rockboxui +LANGUAGE = english DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ $(KEYPAD) $(DISPLAY) $(EXTRA_DEFINES) @@ -49,7 +50,7 @@ $(KEYPAD) $(DISPLAY) $(EXTRA_DEFINES) LDFLAGS = -lX11 -lm -lXt -lXmu -lnsl # Use this for simulator-only files -INCLUDES = -I. -I$(DRIVERS) -I$(COMMON) -I$(FIRMWAREDIR) -I$(APPDIR) -I$(MACHINEDIR) -I../common +INCLUDES = -I. -I$(DRIVERS) -I$(COMMON) -I$(FIRMWAREDIR) -I$(APPDIR) -I$(MACHINEDIR) -I../common -I$(OBJDIR) SRCDIRS = . $(DRIVERS) $(COMMON) $(FIRMWAREDIR) $(APPDIR) $(MACHINEDIR) # The true Rockbox Applications should use this include path: @@ -80,8 +81,7 @@ FIRMSRCS = lcd.c sprintf.c id3.c debug.c usb.c mpeg.c power.c\ powermgmt.c font.c X5x8.c loadfont.c panic.c APPS = main.c tree.c menu.c credits.c main_menu.c\ - playlist.c showtext.c wps.c wps-display.c settings.c status.c icons.c \ - lang.c + playlist.c showtext.c wps.c wps-display.c settings.c status.c icons.c MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c @@ -98,7 +98,7 @@ ifdef MPEG_PLAY INCLUDES += -I$(LIBMADDIR) endif -OBJS := $(SRCS:%.c=$(OBJDIR)/%.o) +OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) all: $(TARGET) $(EXTRA_TARGETS) @@ -214,8 +214,9 @@ $(OBJDIR)/playlist.o: $(APPDIR)/playlist.c $(OBJDIR)/showtext.o: $(APPDIR)/showtext.c $(CC) $(APPCFLAGS) -c $< -o $@ -$(OBJDIR)/lang.o: $(APPDIR)/lang.c - $(CC) $(APPCFLAGS) -c $< -o $@ +$(OBJDIR)/lang.o: $(APPDIR)/lang/$(LANGUAGE).lang + $(TOOLSDIR)/genlang -p=$(OBJDIR)/lang $< + $(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@ $(OBJDIR)/lcd.o: $(DRIVERS)/lcd.c $(CC) $(CFLAGS) -c $< -o $@