1
0
Fork 0
forked from len0rd/rockbox

voice: Convert a pile of splashf() messages to be voiced

Basically, this just replaces str(STRID) with ID2P(STRID).

The voiced version of these strings cannot not have any format
specifiers (enforced by the language tooling) and are instead more
generic.

As many of these are error conditions, it is doubly important for
them to be voiced in some way.

There are some places in the code that perform their own voicing
for splash messages (eg the shutdown code); those are left alone.

Change-Id: I7d51af351e8fa5c4beee42fbfc02719f1d6591b8
This commit is contained in:
Solomon Peachy 2025-05-17 17:33:46 -04:00
parent cde144233b
commit 39f86858c4
15 changed files with 29 additions and 29 deletions

View file

@ -74,7 +74,7 @@ int alarm_screen(void)
talk_value(mins_togo % 60, UNIT_MIN, true);
talk_force_enqueue_next();
}
splashf(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO),
splashf(HZ*2, ID2P(LANG_ALARM_MOD_TIME_TO_GO),
mins_togo / 60, mins_togo % 60);
} else {
splash(HZ, ID2P(LANG_ALARM_MOD_ERROR));

View file

@ -122,7 +122,7 @@ int ft_build_playlist(struct tree_context* c, int start_index)
}
cpu_boost(false);
}
playlist_insert_context_release(&pl_context);
tree_unlock_cache(c);
@ -455,7 +455,7 @@ static void ft_load_font(char *file)
int current_font_id;
enum screen_type screen = SCREEN_MAIN;
#if NB_SCREENS > 1
MENUITEM_STRINGLIST(menu, ID2P(LANG_CUSTOM_FONT), NULL,
MENUITEM_STRINGLIST(menu, ID2P(LANG_CUSTOM_FONT), NULL,
ID2P(LANG_MAIN_SCREEN), ID2P(LANG_REMOTE_SCREEN))
switch (do_menu(&menu, NULL, NULL, false))
{
@ -560,7 +560,7 @@ int ft_enter(struct tree_context* c)
struct entry* file = tree_get_entry_at(c, c->selected_item);
if (!file)
{
splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN));
splashf(HZ, ID2P(LANG_READ_FAILED), str(LANG_UNKNOWN));
return rc;
}
@ -602,7 +602,7 @@ int ft_enter(struct tree_context* c)
if (!warn_on_pl_erase())
break;
if (global_settings.party_mode && audio_status())
if (global_settings.party_mode && audio_status())
{
playlist_insert_track(NULL, buf,
PLAYLIST_INSERT_LAST, true, true);
@ -768,7 +768,7 @@ int ft_enter(struct tree_context* c)
file = tree_get_entry_at(c, c->selected_item);
if (!file)
{
splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN));
splashf(HZ, ID2P(LANG_READ_FAILED), str(LANG_UNKNOWN));
return rc;
}
@ -833,7 +833,7 @@ int ft_exit(struct tree_context* c)
extern char lastfile[]; /* from tree.c */
char buf[MAX_PATH];
int rc = 0;
bool exit_func = false;
bool exit_func = false;
int i = strlen(c->currdir);
/* strip trailing slashes */

View file

@ -2173,7 +2173,7 @@ static bool skin_load_fonts(struct wps_data *data)
{
if (success)
{
splashf(HZ, str(LANG_FONT_LOAD_ERROR), "(no name)");
splashf(HZ, ID2P(LANG_FONT_LOAD_ERROR), "(no name)");
DEBUGF("font %d not specified\n", font_id);
}
success = false;
@ -2198,7 +2198,7 @@ static bool skin_load_fonts(struct wps_data *data)
if (font->id < 0)
{
splashf(HZ, str(LANG_FONT_LOAD_ERROR), font->name);
splashf(HZ, ID2P(LANG_FONT_LOAD_ERROR), font->name);
DEBUGF("Unable to load font %d: '%s'\n", font_id, font->name);
font->name = NULL; /* to stop trying to load it again if we fail */
success = false;

View file

@ -222,7 +222,7 @@ bool show_search_progress(bool init, int display_count, int current, int total)
display_count, str(LANG_OFF_ABORT));
}
else
splashf(0, str(LANG_PLAYLIST_SEARCH_MSG),
splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG),
display_count, str(LANG_OFF_ABORT));
if (action_userabort(TIMEOUT_NOBLOCK))

View file

@ -348,7 +348,7 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p
logf("OP add_path Invalid, *Clearing entry*");
if (lang_id != LANG_SHORTCUTS) /* from shortcuts menu */
splashf(HZ * 2, str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
splashf(HZ * 2, ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
op_clear_entry(op_entry);
return 0;
}

View file

@ -684,7 +684,7 @@ static void display_playlist_count(int count, const unsigned char *fmt,
}
}
splashf(0, P2STR(fmt), count, str(LANG_OFF_ABORT));
splashf(0, fmt, count, str(LANG_OFF_ABORT));
}
/*

View file

@ -100,7 +100,7 @@ static int initialize_catalog_buf(char* dirbuf, size_t dirbuf_sz)
talk_dir_or_spell(dirbuf, NULL, true);
talk_force_enqueue_next();
}
splashf(HZ*2, str(LANG_CATALOG_NO_DIRECTORY), dirbuf);
splashf(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), dirbuf);
return -1;
}
else {
@ -265,7 +265,7 @@ static void display_insert_count(int count)
talk_id(LANG_PLAYLIST_INSERT_COUNT, true);
}
splashf(0, str(LANG_PLAYLIST_INSERT_COUNT), count, str(LANG_OFF_ABORT));
splashf(0, ID2P(LANG_PLAYLIST_INSERT_COUNT), count, str(LANG_OFF_ABORT));
}
/* Add specified track into playlist. Callback from directory insert */

View file

@ -1271,7 +1271,7 @@ bool search_playlist(void)
{
if (found_indicies_count != last_found_count)
{
splashf(0, str(LANG_PLAYLIST_SEARCH_MSG), found_indicies_count,
splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG), found_indicies_count,
str(LANG_OFF_ABORT));
last_found_count = found_indicies_count;
}

View file

@ -711,7 +711,7 @@ static void mm_errorhandler(void)
rb->talk_value_decimal(MikMod_errno, UNIT_INT, 0, true);
rb->talk_force_enqueue_next();
}
rb->splashf(HZ, rb->str(LANG_ERROR_FORMATSTR), MikMod_strerror(MikMod_errno));
rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), MikMod_strerror(MikMod_errno));
quit = true;
}

View file

@ -361,7 +361,7 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha
plugin = rb->filetype_get_plugin(fattr, buf, sizeof(buf));
if (!plugin)
{
rb->splashf(HZ * 2, rb->str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
rb->splashf(HZ * 2, ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
return 0;
}
}
@ -420,7 +420,7 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha
else
{
if (op_entry.lang_id != LANG_SHORTCUTS)
rb->splashf(HZ * 2, rb->str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
rb->splashf(HZ * 2, ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
return 0;
}
}

View file

@ -130,7 +130,7 @@ static void fileerror(int rc)
rb->talk_force_enqueue_next();
}
rb->splashf(HZ*2, rb->str(LANG_FILE_ERROR), rc);
rb->splashf(HZ*2, ID2P(LANG_FILE_ERROR), rc);
}
static const unsigned char empty_id3_header[] =

View file

@ -581,7 +581,7 @@ int presets_scan(void *viewports)
frac = freq % 100;
freq /= 100;
splashf(0, str(LANG_FM_SCANNING), freq, frac);
splashf(0, ID2P(LANG_FM_SCANNING), freq, frac);
if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq))
{

View file

@ -257,7 +257,7 @@ static int browser(void* param)
}
else
{
splashf(0, str(LANG_BUILDING_DATABASE),
splashf(0, ID2P(LANG_BUILDING_DATABASE),
stat->processed_entries);
}
}

View file

@ -1065,7 +1065,7 @@ int tagtree_export(void)
{
struct tagcache_search tcs;
splash(0, str(LANG_CREATING));
splash(0, ID2P(LANG_CREATING));
if (!tagcache_create_changelog(&tcs))
{
splash(HZ*2, ID2P(LANG_FAILED));
@ -1872,7 +1872,7 @@ entry_skip_formatter:
talk_value(total_count, UNIT_INT, true);
}
splashf(HZ*4, str(LANG_SHOWDIR_BUFFER_FULL), total_count);
splashf(HZ*4, ID2P(LANG_SHOWDIR_BUFFER_FULL), total_count);
logf("Too small dir buffer");
return 0;
}
@ -2012,10 +2012,10 @@ int tagtree_load(struct tree_context* c)
if (count < 0)
{
if (count != RELOAD_TAGTREE)
splash(HZ, str(LANG_TAGCACHE_BUSY));
splash(HZ, ID2P(LANG_TAGCACHE_BUSY));
else /* unload and re-init tagtree */
{
splash(HZ, str(LANG_WAIT));
splash(HZ, ID2P(LANG_WAIT));
tagtree_unload(c);
if (!initialize_tagtree())
return 0;
@ -2404,7 +2404,7 @@ static bool insert_all_playlist(struct tree_context *c,
n, slots_remaining);
talk_id(LANG_RANDOM_SHUFFLE_RANDOM_SELECTIVE_SONGS_SUMMARY, true);
splashf(HZ * 2, str(LANG_RANDOM_SHUFFLE_RANDOM_SELECTIVE_SONGS_SUMMARY),
splashf(HZ * 2, ID2P(LANG_RANDOM_SHUFFLE_RANDOM_SELECTIVE_SONGS_SUMMARY),
slots_remaining);
}
}
@ -2414,7 +2414,7 @@ static bool insert_all_playlist(struct tree_context *c,
{
if (TIME_AFTER(current_tick, last_tick + HZ/4))
{
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT));
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); // XXX not voiced
if (action_userabort(TIMEOUT_NOBLOCK))
{
exit_loop_now = true;
@ -2592,7 +2592,7 @@ bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
n = tc->filesindir;
for (i = 0; i < n; i++)
{
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT));
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); // XXX not voiced
if (TIME_AFTER(current_tick, last_tick + HZ/4))
{
if (action_userabort(TIMEOUT_NOBLOCK))

View file

@ -926,7 +926,7 @@ void talk_init(void)
if (!load_voicefile_index(filehandle))
{
if (global_settings.talk_menu)
splashf(HZ, str(LANG_READ_FAILED), ".voice");
splashf(HZ, ID2P(LANG_READ_FAILED), ".voice");
goto out;
}
/* Now determine the maximum buffer size needed for the voicefile.