summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_menu.c
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 /apps/plugins/text_viewer/tv_menu.c
parent8c6b579b32072dfdf07c5859917262654bb55e98 (diff)
downloadrockbox-c97954f0144e9f91775ff96896d9533624a91c00.tar.gz
rockbox-c97954f0144e9f91775ff96896d9533624a91c00.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
Diffstat (limited to 'apps/plugins/text_viewer/tv_menu.c')
-rw-r--r--apps/plugins/text_viewer/tv_menu.c63
1 files changed, 35 insertions, 28 deletions
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)
42static bool tv_horizontal_scroll_mode_setting(void) 42static bool tv_horizontal_scroll_mode_setting(void)
43{ 43{
44 static const struct opt_items names[] = { 44 static const struct opt_items names[] = {
45 {"Scroll by Screen", -1}, 45 {"Scroll by Screen", -1}, // XXX i18n
46 {"Scroll by Column", -1}, 46 {"Scroll by Column", -1},
47 }; 47 };
48 48
@@ -50,12 +50,12 @@ static bool tv_horizontal_scroll_mode_setting(void)
50 names, 2, NULL); 50 names, 2, NULL);
51} 51}
52 52
53MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, "Scrollbar", 53MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
54 tv_horizontal_scrollbar_setting, NULL, Icon_NOICON); 54 tv_horizontal_scrollbar_setting, NULL, Icon_NOICON);
55MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode", 55MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode", // XXX i18n
56 tv_horizontal_scroll_mode_setting, NULL, Icon_NOICON); 56 tv_horizontal_scroll_mode_setting, NULL, Icon_NOICON);
57 57
58MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON, 58MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON, // XXX i18n
59 &horizontal_scrollbar_item, 59 &horizontal_scrollbar_item,
60 &horizontal_scroll_mode_item); 60 &horizontal_scroll_mode_item);
61 61
@@ -65,43 +65,43 @@ MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
65 65
66static bool tv_vertical_scrollbar_setting(void) 66static bool tv_vertical_scrollbar_setting(void)
67{ 67{
68 return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar); 68 return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar); // XXX i18n
69} 69}
70 70
71static bool tv_vertical_scroll_mode_setting(void) 71static bool tv_vertical_scroll_mode_setting(void)
72{ 72{
73 static const struct opt_items names[] = { 73 static const struct opt_items names[] = {
74 {"Scroll by Page", -1}, 74 {"Scroll by Page", -1}, // XXX i18n
75 {"Scroll by Line", -1}, 75 {"Scroll by Line", -1},
76 }; 76 };
77 77
78 return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, RB_INT, 78 return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, RB_INT, // XXX i18n
79 names, 2, NULL); 79 names, 2, NULL);
80} 80}
81 81
82static bool tv_overlap_page_mode_setting(void) 82static bool tv_overlap_page_mode_setting(void)
83{ 83{
84 return rb->set_bool("Overlap Pages", &new_prefs.overlap_page_mode); 84 return rb->set_bool("Overlap Pages", &new_prefs.overlap_page_mode); // XXX i18n
85} 85}
86 86
87static bool tv_autoscroll_speed_setting(void) 87static bool tv_autoscroll_speed_setting(void)
88{ 88{
89 return rb->set_int("Auto-scroll Speed", "", UNIT_INT, 89 return rb->set_int("Auto-scroll Speed", "", UNIT_INT, // XXX i18n
90 &new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL); 90 &new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
91} 91}
92 92
93static bool tv_narrow_mode_setting(void) 93static bool tv_narrow_mode_setting(void)
94{ 94{
95 static const struct opt_items names[] = { 95 static const struct opt_items names[] = {
96 {"Previous/Next Page", -1}, 96 {"Previous/Next Page", -1}, // XXX i18n
97 {"Top/Bottom Page", -1}, 97 {"Top/Bottom Page", -1},
98 }; 98 };
99 99
100 return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, RB_INT, 100 return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, RB_INT, // XXX i18n
101 names, 2, NULL); 101 names, 2, NULL);
102} 102}
103 103
104MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar", 104MENUITEM_FUNCTION(vertical_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
105 tv_vertical_scrollbar_setting, NULL, Icon_NOICON); 105 tv_vertical_scrollbar_setting, NULL, Icon_NOICON);
106MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode", 106MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
107 tv_vertical_scroll_mode_setting, NULL, Icon_NOICON); 107 tv_vertical_scroll_mode_setting, NULL, Icon_NOICON);
@@ -116,11 +116,13 @@ MAKE_MENU(vertical_scroll_menu, "Vertical", NULL, Icon_NOICON,
116 &vertical_scroll_mode_item, &overlap_page_mode_item, &autoscroll_speed_item, 116 &vertical_scroll_mode_item, &overlap_page_mode_item, &autoscroll_speed_item,
117 &narrow_mode_item); 117 &narrow_mode_item);
118 118
119// XXX i18n ^^^
120
119/* */ 121/* */
120/* scroll settings menu */ 122/* scroll settings menu */
121/* */ 123/* */
122 124
123MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON, 125MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON, // XXX i18n
124 &horizontal_scroll_menu, &vertical_scroll_menu); 126 &horizontal_scroll_menu, &vertical_scroll_menu);
125 127
126/* */ 128/* */
@@ -145,8 +147,8 @@ static bool tv_encoding_setting(void)
145static bool tv_word_wrap_setting(void) 147static bool tv_word_wrap_setting(void)
146{ 148{
147 static const struct opt_items names[] = { 149 static const struct opt_items names[] = {
148 {"On", -1}, 150 {STR(LANG_ON)},
149 {"Off (Chop Words)", -1}, 151 {"Off (Chop Words)", -1}, // XXX i18n
150 }; 152 };
151 153
152 return rb->set_option("Word Wrap", &new_prefs.word_mode, RB_INT, 154 return rb->set_option("Word Wrap", &new_prefs.word_mode, RB_INT,
@@ -156,31 +158,31 @@ static bool tv_word_wrap_setting(void)
156static bool tv_line_mode_setting(void) 158static bool tv_line_mode_setting(void)
157{ 159{
158 static const struct opt_items names[] = { 160 static const struct opt_items names[] = {
159 {"Normal", -1}, 161 {STR(LANG_NORMAL)},
160 {"Join Lines", -1}, 162 {"Join Lines", -1}, // XXX i18n
161 {"Expand Lines", -1}, 163 {"Expand Lines", -1},
162 {"Reflow Lines", -1}, 164 {"Reflow Lines", -1},
163 }; 165 };
164 166
165 return rb->set_option("Line Mode", &new_prefs.line_mode, RB_INT, names, 167 return rb->set_option("Line Mode", &new_prefs.line_mode, RB_INT, names,
166 sizeof(names) / sizeof(names[0]), NULL); 168 sizeof(names) / sizeof(names[0]), NULL); // XXX i18n
167} 169}
168 170
169static bool tv_windows_setting(void) 171static bool tv_windows_setting(void)
170{ 172{
171 return rb->set_int("Screens Per Page", "", UNIT_INT, 173 return rb->set_int("Screens Per Page", "", UNIT_INT, // XXX i18n
172 &new_prefs.windows, NULL, 1, 1, 5, NULL); 174 &new_prefs.windows, NULL, 1, 1, 5, NULL);
173} 175}
174 176
175static bool tv_alignment_setting(void) 177static bool tv_alignment_setting(void)
176{ 178{
177 static const struct opt_items names[] = { 179 static const struct opt_items names[] = {
178 {"Left", -1}, 180 {STR(LANG_LEFT)},
179 {"Right", -1}, 181 {STR(LANG_RIGHT)},
180 }; 182 };
181 183
182 return rb->set_option("Alignment", &new_prefs.alignment, RB_INT, 184 return rb->set_option("Alignment", &new_prefs.alignment, RB_INT,
183 names , 2, NULL); 185 names , 2, NULL); // XXX i18n
184} 186}
185 187
186static bool tv_header_setting(void) 188static bool tv_header_setting(void)
@@ -206,7 +208,7 @@ static bool tv_font_setting(void)
206 struct browse_context browse = { 208 struct browse_context browse = {
207 .dirfilter = SHOW_FONT, 209 .dirfilter = SHOW_FONT,
208 .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, 210 .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU,
209 .title = "Font", /* XXX: Translate? */ 211 .title = ID2P(LANG_CUSTOM_FONT),
210 .icon = Icon_Menu_setting, 212 .icon = Icon_Menu_setting,
211 .root = FONT_DIR, 213 .root = FONT_DIR,
212 .selected = name, 214 .selected = name,
@@ -229,7 +231,7 @@ static bool tv_font_setting(void)
229 231
230static bool tv_indent_spaces_setting(void) 232static bool tv_indent_spaces_setting(void)
231{ 233{
232 return rb->set_int("Indent Spaces", "", UNIT_INT, 234 return rb->set_int("Indent Spaces", "", UNIT_INT,
233 &new_prefs.indent_spaces, NULL, 1, 0, 5, NULL); 235 &new_prefs.indent_spaces, NULL, 1, 0, 5, NULL);
234} 236}
235 237
@@ -256,7 +258,7 @@ MENUITEM_FUNCTION(footer_item, 0, "Show Footer",
256 tv_footer_setting, NULL, Icon_NOICON); 258 tv_footer_setting, NULL, Icon_NOICON);
257MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar", 259MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar",
258 tv_statusbar_setting, NULL, Icon_NOICON); 260 tv_statusbar_setting, NULL, Icon_NOICON);
259MENUITEM_FUNCTION(font_item, 0, "Font", 261MENUITEM_FUNCTION(font_item, 0, ID2P(LANG_CUSTOM_FONT),
260 tv_font_setting, NULL, Icon_NOICON); 262 tv_font_setting, NULL, Icon_NOICON);
261MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces", 263MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces",
262 tv_indent_spaces_setting, NULL, Icon_NOICON); 264 tv_indent_spaces_setting, NULL, Icon_NOICON);
@@ -274,6 +276,7 @@ MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
274 , &night_mode_item 276 , &night_mode_item
275#endif 277#endif
276 ); 278 );
279// XXX finish i18n ^^^
277 280
278static unsigned tv_options_menu(void) 281static unsigned tv_options_menu(void)
279{ 282{
@@ -290,9 +293,13 @@ unsigned tv_display_menu(void)
290 unsigned result = TV_MENU_RESULT_EXIT_MENU; 293 unsigned result = TV_MENU_RESULT_EXIT_MENU;
291 294
292 MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL, 295 MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL,
293 "Return", "Viewer Options", 296 ID2P(LANG_RETURN),
294 "Show Playback Menu", "Select Bookmark", 297 "Viewer Options",
295 "Global Settings", "Quit"); 298 ID2P(LANG_PLAYBACK_CONTROL),
299 ID2P(LANG_BOOKMARK_SELECT_BOOKMARK),
300 "Global Settings",
301 ID2P(LANG_MENU_QUIT));
302 // XXX finish i18n ^^^
296 303
297 switch (rb->do_menu(&menu, NULL, NULL, false)) 304 switch (rb->do_menu(&menu, NULL, NULL, false))
298 { 305 {