mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
FS#13434: Partially internationalize the textviewer plugin
* Converted over all previously-translated strings * Lots of comments added to mark the next phase * Voice filename of the file being loaded if possible Change-Id: Ia3219bbfa4505ad29a25bcf1d6eacc94c59a2a83
This commit is contained in:
parent
8c6b579b32
commit
c97954f014
6 changed files with 58 additions and 43 deletions
|
@ -31,7 +31,7 @@
|
||||||
enum plugin_status plugin_start(const void* file)
|
enum plugin_status plugin_start(const void* file)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
#if defined(TV_AUTOSCROLL_PRE)
|
#if defined(TV_AUTOSCROLL_PRE)
|
||||||
int lastbutton = BUTTON_NONE;
|
int lastbutton = BUTTON_NONE;
|
||||||
#endif
|
#endif
|
||||||
bool autoscroll = false;
|
bool autoscroll = false;
|
||||||
|
@ -50,12 +50,20 @@ enum plugin_status plugin_start(const void* file)
|
||||||
plugin_buf = rb->plugin_get_buffer(&size);
|
plugin_buf = rb->plugin_get_buffer(&size);
|
||||||
|
|
||||||
if (!tv_init_action(&plugin_buf, &size)) {
|
if (!tv_init_action(&plugin_buf, &size)) {
|
||||||
rb->splash(HZ, "Error initialize");
|
rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), "initialize");
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Voice that we're loading the file... */
|
||||||
|
if (rb->global_settings->talk_menu) {
|
||||||
|
rb->talk_id(LANG_WAIT, true);
|
||||||
|
rb->talk_file_or_spell(NULL, file, NULL, true);
|
||||||
|
rb->talk_force_enqueue_next();
|
||||||
|
}
|
||||||
|
// rb->splashf(HZ/2, "%s %s", rb->str(LANG_WAIT), file);
|
||||||
|
|
||||||
if (!tv_load_file(file)) {
|
if (!tv_load_file(file)) {
|
||||||
rb->splash(HZ, "Error opening file");
|
rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), "reading file");
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +223,7 @@ enum plugin_status plugin_start(const void* file)
|
||||||
}
|
}
|
||||||
if (button != BUTTON_NONE)
|
if (button != BUTTON_NONE)
|
||||||
{
|
{
|
||||||
#if defined(TV_AUTOSCROLL_PRE)
|
#if defined(TV_AUTOSCROLL_PRE)
|
||||||
lastbutton = button;
|
lastbutton = button;
|
||||||
#endif
|
#endif
|
||||||
rb->yield();
|
rb->yield();
|
||||||
|
|
|
@ -58,7 +58,7 @@ void tv_exit(void)
|
||||||
{
|
{
|
||||||
DEBUGF("Saving settings\n");
|
DEBUGF("Saving settings\n");
|
||||||
if (!tv_save_settings())
|
if (!tv_save_settings())
|
||||||
rb->splash(HZ, "Can't save preferences and bookmarks");
|
rb->splash(HZ, "Can't save preferences and bookmarks"); // XXX i18n
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DEBUGF("Skip saving settings\n");
|
DEBUGF("Skip saving settings\n");
|
||||||
|
|
|
@ -149,13 +149,13 @@ void tv_toggle_bookmark(void)
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
{
|
{
|
||||||
if (tv_add_bookmark(pos) >= 0)
|
if (tv_add_bookmark(pos) >= 0)
|
||||||
rb->splash(HZ/2, "Bookmark add");
|
rb->splash(HZ/2, ID2P(LANG_BOOKMARK_CREATE_SUCCESS));
|
||||||
else
|
else
|
||||||
rb->splash(HZ/2, "No more add bookmark");
|
rb->splash(HZ/2, "No more add bookmark"); // XXX i18n
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tv_remove_bookmark(idx);
|
tv_remove_bookmark(idx);
|
||||||
rb->splash(HZ/2, "Bookmark remove");
|
rb->splash(HZ/2, "Bookmark remove"); // XXX i18n
|
||||||
}
|
}
|
||||||
|
|
||||||
void tv_create_system_bookmark(void)
|
void tv_create_system_bookmark(void)
|
||||||
|
@ -233,9 +233,9 @@ void tv_select_bookmark(void)
|
||||||
tv_copy_screen_pos(&select_pos);
|
tv_copy_screen_pos(&select_pos);
|
||||||
|
|
||||||
if (select_pos.file_pos == 0)
|
if (select_pos.file_pos == 0)
|
||||||
rb->splash(HZ, "Start the first page");
|
rb->splash(HZ, "Start the first page"); // XXX i18n
|
||||||
else
|
else
|
||||||
rb->splash(HZ, "Return to the current page");
|
rb->splash(HZ, "Return to the current page"); // XXX i18n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ static bool tv_set_font(const unsigned char *font)
|
||||||
tv_change_fontid(rb->font_load(path));
|
tv_change_fontid(rb->font_load(path));
|
||||||
if (preferences->font_id < 0)
|
if (preferences->font_id < 0)
|
||||||
{
|
{
|
||||||
rb->splash(HZ/2, "font load failed");
|
rb->splash(HZ/2, "font load failed"); // XXX i18n
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ static int tv_change_preferences(const struct tv_preferences *oldp)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* tv_set_font(rb->global_settings->font_file) doesn't fail usually.
|
* tv_set_font(rb->global_settings->font_file) doesn't fail usually.
|
||||||
* if it fails, a fatal problem occurs in Rockbox.
|
* if it fails, a fatal problem occurs in Rockbox.
|
||||||
*/
|
*/
|
||||||
if (!rb->strcmp(preferences->font_name, rb->global_settings->font_file))
|
if (!rb->strcmp(preferences->font_name, rb->global_settings->font_file))
|
||||||
return TV_CALLBACK_ERROR;
|
return TV_CALLBACK_ERROR;
|
||||||
|
|
|
@ -42,7 +42,7 @@ static bool tv_horizontal_scrollbar_setting(void)
|
||||||
static bool tv_horizontal_scroll_mode_setting(void)
|
static bool tv_horizontal_scroll_mode_setting(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
{"Scroll by Screen", -1},
|
{"Scroll by Screen", -1}, // XXX i18n
|
||||||
{"Scroll by Column", -1},
|
{"Scroll by Column", -1},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,12 +50,12 @@ static bool tv_horizontal_scroll_mode_setting(void)
|
||||||
names, 2, NULL);
|
names, 2, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, "Scrollbar",
|
MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
|
||||||
tv_horizontal_scrollbar_setting, NULL, Icon_NOICON);
|
tv_horizontal_scrollbar_setting, NULL, Icon_NOICON);
|
||||||
MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode",
|
MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode", // XXX i18n
|
||||||
tv_horizontal_scroll_mode_setting, NULL, Icon_NOICON);
|
tv_horizontal_scroll_mode_setting, NULL, Icon_NOICON);
|
||||||
|
|
||||||
MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
|
MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON, // XXX i18n
|
||||||
&horizontal_scrollbar_item,
|
&horizontal_scrollbar_item,
|
||||||
&horizontal_scroll_mode_item);
|
&horizontal_scroll_mode_item);
|
||||||
|
|
||||||
|
@ -65,43 +65,43 @@ MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
|
||||||
|
|
||||||
static bool tv_vertical_scrollbar_setting(void)
|
static bool tv_vertical_scrollbar_setting(void)
|
||||||
{
|
{
|
||||||
return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar);
|
return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar); // XXX i18n
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_vertical_scroll_mode_setting(void)
|
static bool tv_vertical_scroll_mode_setting(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
{"Scroll by Page", -1},
|
{"Scroll by Page", -1}, // XXX i18n
|
||||||
{"Scroll by Line", -1},
|
{"Scroll by Line", -1},
|
||||||
};
|
};
|
||||||
|
|
||||||
return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, RB_INT,
|
return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, RB_INT, // XXX i18n
|
||||||
names, 2, NULL);
|
names, 2, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_overlap_page_mode_setting(void)
|
static bool tv_overlap_page_mode_setting(void)
|
||||||
{
|
{
|
||||||
return rb->set_bool("Overlap Pages", &new_prefs.overlap_page_mode);
|
return rb->set_bool("Overlap Pages", &new_prefs.overlap_page_mode); // XXX i18n
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_autoscroll_speed_setting(void)
|
static bool tv_autoscroll_speed_setting(void)
|
||||||
{
|
{
|
||||||
return rb->set_int("Auto-scroll Speed", "", UNIT_INT,
|
return rb->set_int("Auto-scroll Speed", "", UNIT_INT, // XXX i18n
|
||||||
&new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
|
&new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_narrow_mode_setting(void)
|
static bool tv_narrow_mode_setting(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
{"Previous/Next Page", -1},
|
{"Previous/Next Page", -1}, // XXX i18n
|
||||||
{"Top/Bottom Page", -1},
|
{"Top/Bottom Page", -1},
|
||||||
};
|
};
|
||||||
|
|
||||||
return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, RB_INT,
|
return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, RB_INT, // XXX i18n
|
||||||
names, 2, NULL);
|
names, 2, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar",
|
MENUITEM_FUNCTION(vertical_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
|
||||||
tv_vertical_scrollbar_setting, NULL, Icon_NOICON);
|
tv_vertical_scrollbar_setting, NULL, Icon_NOICON);
|
||||||
MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
|
MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
|
||||||
tv_vertical_scroll_mode_setting, NULL, Icon_NOICON);
|
tv_vertical_scroll_mode_setting, NULL, Icon_NOICON);
|
||||||
|
@ -116,11 +116,13 @@ MAKE_MENU(vertical_scroll_menu, "Vertical", NULL, Icon_NOICON,
|
||||||
&vertical_scroll_mode_item, &overlap_page_mode_item, &autoscroll_speed_item,
|
&vertical_scroll_mode_item, &overlap_page_mode_item, &autoscroll_speed_item,
|
||||||
&narrow_mode_item);
|
&narrow_mode_item);
|
||||||
|
|
||||||
|
// XXX i18n ^^^
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* scroll settings menu */
|
/* scroll settings menu */
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON,
|
MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON, // XXX i18n
|
||||||
&horizontal_scroll_menu, &vertical_scroll_menu);
|
&horizontal_scroll_menu, &vertical_scroll_menu);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -145,8 +147,8 @@ static bool tv_encoding_setting(void)
|
||||||
static bool tv_word_wrap_setting(void)
|
static bool tv_word_wrap_setting(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
{"On", -1},
|
{STR(LANG_ON)},
|
||||||
{"Off (Chop Words)", -1},
|
{"Off (Chop Words)", -1}, // XXX i18n
|
||||||
};
|
};
|
||||||
|
|
||||||
return rb->set_option("Word Wrap", &new_prefs.word_mode, RB_INT,
|
return rb->set_option("Word Wrap", &new_prefs.word_mode, RB_INT,
|
||||||
|
@ -156,31 +158,31 @@ static bool tv_word_wrap_setting(void)
|
||||||
static bool tv_line_mode_setting(void)
|
static bool tv_line_mode_setting(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
{"Normal", -1},
|
{STR(LANG_NORMAL)},
|
||||||
{"Join Lines", -1},
|
{"Join Lines", -1}, // XXX i18n
|
||||||
{"Expand Lines", -1},
|
{"Expand Lines", -1},
|
||||||
{"Reflow Lines", -1},
|
{"Reflow Lines", -1},
|
||||||
};
|
};
|
||||||
|
|
||||||
return rb->set_option("Line Mode", &new_prefs.line_mode, RB_INT, names,
|
return rb->set_option("Line Mode", &new_prefs.line_mode, RB_INT, names,
|
||||||
sizeof(names) / sizeof(names[0]), NULL);
|
sizeof(names) / sizeof(names[0]), NULL); // XXX i18n
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_windows_setting(void)
|
static bool tv_windows_setting(void)
|
||||||
{
|
{
|
||||||
return rb->set_int("Screens Per Page", "", UNIT_INT,
|
return rb->set_int("Screens Per Page", "", UNIT_INT, // XXX i18n
|
||||||
&new_prefs.windows, NULL, 1, 1, 5, NULL);
|
&new_prefs.windows, NULL, 1, 1, 5, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_alignment_setting(void)
|
static bool tv_alignment_setting(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
{"Left", -1},
|
{STR(LANG_LEFT)},
|
||||||
{"Right", -1},
|
{STR(LANG_RIGHT)},
|
||||||
};
|
};
|
||||||
|
|
||||||
return rb->set_option("Alignment", &new_prefs.alignment, RB_INT,
|
return rb->set_option("Alignment", &new_prefs.alignment, RB_INT,
|
||||||
names , 2, NULL);
|
names , 2, NULL); // XXX i18n
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool tv_header_setting(void)
|
static bool tv_header_setting(void)
|
||||||
|
@ -206,7 +208,7 @@ static bool tv_font_setting(void)
|
||||||
struct browse_context browse = {
|
struct browse_context browse = {
|
||||||
.dirfilter = SHOW_FONT,
|
.dirfilter = SHOW_FONT,
|
||||||
.flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU,
|
.flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU,
|
||||||
.title = "Font", /* XXX: Translate? */
|
.title = ID2P(LANG_CUSTOM_FONT),
|
||||||
.icon = Icon_Menu_setting,
|
.icon = Icon_Menu_setting,
|
||||||
.root = FONT_DIR,
|
.root = FONT_DIR,
|
||||||
.selected = name,
|
.selected = name,
|
||||||
|
@ -229,7 +231,7 @@ static bool tv_font_setting(void)
|
||||||
|
|
||||||
static bool tv_indent_spaces_setting(void)
|
static bool tv_indent_spaces_setting(void)
|
||||||
{
|
{
|
||||||
return rb->set_int("Indent Spaces", "", UNIT_INT,
|
return rb->set_int("Indent Spaces", "", UNIT_INT,
|
||||||
&new_prefs.indent_spaces, NULL, 1, 0, 5, NULL);
|
&new_prefs.indent_spaces, NULL, 1, 0, 5, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +258,7 @@ MENUITEM_FUNCTION(footer_item, 0, "Show Footer",
|
||||||
tv_footer_setting, NULL, Icon_NOICON);
|
tv_footer_setting, NULL, Icon_NOICON);
|
||||||
MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar",
|
MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar",
|
||||||
tv_statusbar_setting, NULL, Icon_NOICON);
|
tv_statusbar_setting, NULL, Icon_NOICON);
|
||||||
MENUITEM_FUNCTION(font_item, 0, "Font",
|
MENUITEM_FUNCTION(font_item, 0, ID2P(LANG_CUSTOM_FONT),
|
||||||
tv_font_setting, NULL, Icon_NOICON);
|
tv_font_setting, NULL, Icon_NOICON);
|
||||||
MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces",
|
MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces",
|
||||||
tv_indent_spaces_setting, NULL, Icon_NOICON);
|
tv_indent_spaces_setting, NULL, Icon_NOICON);
|
||||||
|
@ -274,6 +276,7 @@ MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
|
||||||
, &night_mode_item
|
, &night_mode_item
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
// XXX finish i18n ^^^
|
||||||
|
|
||||||
static unsigned tv_options_menu(void)
|
static unsigned tv_options_menu(void)
|
||||||
{
|
{
|
||||||
|
@ -290,9 +293,13 @@ unsigned tv_display_menu(void)
|
||||||
unsigned result = TV_MENU_RESULT_EXIT_MENU;
|
unsigned result = TV_MENU_RESULT_EXIT_MENU;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL,
|
MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL,
|
||||||
"Return", "Viewer Options",
|
ID2P(LANG_RETURN),
|
||||||
"Show Playback Menu", "Select Bookmark",
|
"Viewer Options",
|
||||||
"Global Settings", "Quit");
|
ID2P(LANG_PLAYBACK_CONTROL),
|
||||||
|
ID2P(LANG_BOOKMARK_SELECT_BOOKMARK),
|
||||||
|
"Global Settings",
|
||||||
|
ID2P(LANG_MENU_QUIT));
|
||||||
|
// XXX finish i18n ^^^
|
||||||
|
|
||||||
switch (rb->do_menu(&menu, NULL, NULL, false))
|
switch (rb->do_menu(&menu, NULL, NULL, false))
|
||||||
{
|
{
|
||||||
|
|
|
@ -218,7 +218,7 @@ void tv_convert_fpos(off_t fpos, struct tv_screen_pos *pos)
|
||||||
|
|
||||||
tv_seek_page(i, SEEK_SET);
|
tv_seek_page(i, SEEK_SET);
|
||||||
while (tv_create_line_positions() && cur_pos.file_pos < fpos)
|
while (tv_create_line_positions() && cur_pos.file_pos < fpos)
|
||||||
rb->splashf(0, "converting %ld%%...", 100 * cur_pos.file_pos / fpos);
|
rb->splashf(0, "converting %ld%%...", 100 * cur_pos.file_pos / fpos); // XXX i18n
|
||||||
|
|
||||||
if (i < max_page)
|
if (i < max_page)
|
||||||
cur_pos.page--;
|
cur_pos.page--;
|
||||||
|
@ -239,7 +239,7 @@ static void tv_seek_to_bottom_line(void)
|
||||||
|
|
||||||
tv_seek_page(0, SEEK_END);
|
tv_seek_page(0, SEEK_END);
|
||||||
while (tv_create_line_positions())
|
while (tv_create_line_positions())
|
||||||
rb->splashf(0, "loading %ld%%...", 100 * cur_pos.file_pos / total_size);
|
rb->splashf(0, "loading %ld%%...", 100 * cur_pos.file_pos / total_size); // XXX i18n
|
||||||
|
|
||||||
cur_pos.line = lines_per_page - 1;
|
cur_pos.line = lines_per_page - 1;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void tv_move_screen(int page_offset, int line_offset, int whence)
|
||||||
|
|
||||||
tv_seek_page(new_pos.page, SEEK_SET);
|
tv_seek_page(new_pos.page, SEEK_SET);
|
||||||
while (cur_pos.page < new_pos.page && tv_create_line_positions())
|
while (cur_pos.page < new_pos.page && tv_create_line_positions())
|
||||||
rb->splashf(0, "loading %d%%...", 100 * cur_pos.page / new_pos.page);
|
rb->splashf(0, "loading %d%%...", 100 * cur_pos.page / new_pos.page); // XXX i18n
|
||||||
|
|
||||||
if (new_pos.line == 0)
|
if (new_pos.line == 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue