summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-06-11 09:53:40 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-06-11 09:53:40 -0400
commitc97954f0144e9f91775ff96896d9533624a91c00 (patch)
tree1d309b6ebd9ce0e259dc217917a58b714dc9f2ec
parent8c6b579b32072dfdf07c5859917262654bb55e98 (diff)
downloadrockbox-c97954f014.tar.gz
rockbox-c97954f014.zip
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
-rw-r--r--apps/plugins/text_viewer/text_viewer.c16
-rw-r--r--apps/plugins/text_viewer/tv_action.c2
-rw-r--r--apps/plugins/text_viewer/tv_bookmark.c10
-rw-r--r--apps/plugins/text_viewer/tv_display.c4
-rw-r--r--apps/plugins/text_viewer/tv_menu.c63
-rw-r--r--apps/plugins/text_viewer/tv_pager.c6
6 files changed, 58 insertions, 43 deletions
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c
index fea0977c0d..91c3ae9237 100644
--- a/apps/plugins/text_viewer/text_viewer.c
+++ b/apps/plugins/text_viewer/text_viewer.c
@@ -31,7 +31,7 @@
enum plugin_status plugin_start(const void* file)
{
int button;
-#if defined(TV_AUTOSCROLL_PRE)
+#if defined(TV_AUTOSCROLL_PRE)
int lastbutton = BUTTON_NONE;
#endif
bool autoscroll = false;
@@ -50,12 +50,20 @@ enum plugin_status plugin_start(const void* file)
plugin_buf = rb->plugin_get_buffer(&size);
if (!tv_init_action(&plugin_buf, &size)) {
- rb->splash(HZ, "Error initialize");
+ rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), "initialize");
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)) {
- rb->splash(HZ, "Error opening file");
+ rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), "reading file");
return PLUGIN_ERROR;
}
@@ -215,7 +223,7 @@ enum plugin_status plugin_start(const void* file)
}
if (button != BUTTON_NONE)
{
-#if defined(TV_AUTOSCROLL_PRE)
+#if defined(TV_AUTOSCROLL_PRE)
lastbutton = button;
#endif
rb->yield();
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c
index 041dee5a50..6d12889123 100644
--- a/apps/plugins/text_viewer/tv_action.c
+++ b/apps/plugins/text_viewer/tv_action.c
@@ -58,7 +58,7 @@ void tv_exit(void)
{
DEBUGF("Saving settings\n");
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
DEBUGF("Skip saving settings\n");
diff --git a/apps/plugins/text_viewer/tv_bookmark.c b/apps/plugins/text_viewer/tv_bookmark.c
index 1edad093a9..1ae75d69b5 100644
--- a/apps/plugins/text_viewer/tv_bookmark.c
+++ b/apps/plugins/text_viewer/tv_bookmark.c
@@ -149,13 +149,13 @@ void tv_toggle_bookmark(void)
if (idx < 0)
{
if (tv_add_bookmark(pos) >= 0)
- rb->splash(HZ/2, "Bookmark add");
+ rb->splash(HZ/2, ID2P(LANG_BOOKMARK_CREATE_SUCCESS));
else
- rb->splash(HZ/2, "No more add bookmark");
+ rb->splash(HZ/2, "No more add bookmark"); // XXX i18n
return;
}
tv_remove_bookmark(idx);
- rb->splash(HZ/2, "Bookmark remove");
+ rb->splash(HZ/2, "Bookmark remove"); // XXX i18n
}
void tv_create_system_bookmark(void)
@@ -233,9 +233,9 @@ void tv_select_bookmark(void)
tv_copy_screen_pos(&select_pos);
if (select_pos.file_pos == 0)
- rb->splash(HZ, "Start the first page");
+ rb->splash(HZ, "Start the first page"); // XXX i18n
else
- rb->splash(HZ, "Return to the current page");
+ rb->splash(HZ, "Return to the current page"); // XXX i18n
}
}
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c
index 9ecfd8d709..9eb1151672 100644
--- a/apps/plugins/text_viewer/tv_display.c
+++ b/apps/plugins/text_viewer/tv_display.c
@@ -281,7 +281,7 @@ static bool tv_set_font(const unsigned char *font)
tv_change_fontid(rb->font_load(path));
if (preferences->font_id < 0)
{
- rb->splash(HZ/2, "font load failed");
+ rb->splash(HZ/2, "font load failed"); // XXX i18n
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.
- * 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))
return TV_CALLBACK_ERROR;
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index 74a964ba98..15b684fe08 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -42,7 +42,7 @@ static bool tv_horizontal_scrollbar_setting(void)
static bool tv_horizontal_scroll_mode_setting(void)
{
static const struct opt_items names[] = {
- {"Scroll by Screen", -1},
+ {"Scroll by Screen", -1}, // XXX i18n
{"Scroll by Column", -1},
};
@@ -50,12 +50,12 @@ static bool tv_horizontal_scroll_mode_setting(void)
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);
-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);
-MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
+MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON, // XXX i18n
&horizontal_scrollbar_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)
{
- 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 const struct opt_items names[] = {
- {"Scroll by Page", -1},
+ {"Scroll by Page", -1}, // XXX i18n
{"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);
}
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)
{
- 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);
}
static bool tv_narrow_mode_setting(void)
{
static const struct opt_items names[] = {
- {"Previous/Next Page", -1},
+ {"Previous/Next Page", -1}, // XXX i18n
{"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);
}
-MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar",
+MENUITEM_FUNCTION(vertical_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
tv_vertical_scrollbar_setting, NULL, Icon_NOICON);
MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
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,
&narrow_mode_item);
+// XXX i18n ^^^
+
/* */
/* 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);
/* */
@@ -145,8 +147,8 @@ static bool tv_encoding_setting(void)
static bool tv_word_wrap_setting(void)
{
static const struct opt_items names[] = {
- {"On", -1},
- {"Off (Chop Words)", -1},
+ {STR(LANG_ON)},
+ {"Off (Chop Words)", -1}, // XXX i18n
};
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 const struct opt_items names[] = {
- {"Normal", -1},
- {"Join Lines", -1},
+ {STR(LANG_NORMAL)},
+ {"Join Lines", -1}, // XXX i18n
{"Expand Lines", -1},
{"Reflow Lines", -1},
};
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)
{
- 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);
}
static bool tv_alignment_setting(void)
{
static const struct opt_items names[] = {
- {"Left", -1},
- {"Right", -1},
+ {STR(LANG_LEFT)},
+ {STR(LANG_RIGHT)},
};
return rb->set_option("Alignment", &new_prefs.alignment, RB_INT,
- names , 2, NULL);
+ names , 2, NULL); // XXX i18n
}
static bool tv_header_setting(void)
@@ -206,7 +208,7 @@ static bool tv_font_setting(void)
struct browse_context browse = {
.dirfilter = SHOW_FONT,
.flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU,
- .title = "Font", /* XXX: Translate? */
+ .title = ID2P(LANG_CUSTOM_FONT),
.icon = Icon_Menu_setting,
.root = FONT_DIR,
.selected = name,
@@ -229,7 +231,7 @@ static bool tv_font_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);
}
@@ -256,7 +258,7 @@ MENUITEM_FUNCTION(footer_item, 0, "Show Footer",
tv_footer_setting, NULL, Icon_NOICON);
MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar",
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);
MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces",
tv_indent_spaces_setting, NULL, Icon_NOICON);
@@ -274,6 +276,7 @@ MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
, &night_mode_item
#endif
);
+// XXX finish i18n ^^^
static unsigned tv_options_menu(void)
{
@@ -290,9 +293,13 @@ unsigned tv_display_menu(void)
unsigned result = TV_MENU_RESULT_EXIT_MENU;
MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL,
- "Return", "Viewer Options",
- "Show Playback Menu", "Select Bookmark",
- "Global Settings", "Quit");
+ ID2P(LANG_RETURN),
+ "Viewer Options",
+ 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))
{
diff --git a/apps/plugins/text_viewer/tv_pager.c b/apps/plugins/text_viewer/tv_pager.c
index e9886e09dd..0e775f6d0d 100644
--- a/apps/plugins/text_viewer/tv_pager.c
+++ b/apps/plugins/text_viewer/tv_pager.c
@@ -218,7 +218,7 @@ void tv_convert_fpos(off_t fpos, struct tv_screen_pos *pos)
tv_seek_page(i, SEEK_SET);
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)
cur_pos.page--;
@@ -239,7 +239,7 @@ static void tv_seek_to_bottom_line(void)
tv_seek_page(0, SEEK_END);
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;
}
@@ -286,7 +286,7 @@ void tv_move_screen(int page_offset, int line_offset, int whence)
tv_seek_page(new_pos.page, SEEK_SET);
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)
return;