From 8cb8a30f9d8e87fbd1103abef6447358393cfcd1 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Thu, 20 Jun 2024 15:19:06 -0400 Subject: [Feature] talk.c allow Invalid voice files for selected language (if it exists) Change-Id: I3aacfc31e3e8a9cac7c9dae0e99c234e43da953a --- apps/talk.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/talk.c b/apps/talk.c index fb2f9cf3df..ddc95e697b 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -1587,7 +1587,21 @@ void talk_announce_voice_invalid(void) int buf_handle; struct queue_entry qe; - const char talkfile[] = LANG_DIR "/InvalidVoice_" DEFAULT_VOICE_LANG ".talk"; + char talkfile[MAX_PATH]; + const char* const p_lang_def = DEFAULT_VOICE_LANG; /* default */ + const char* p_lang = p_lang_def; + + /* attempt to load Invalid voice clip in proper lang otherwise use default */ + if (global_settings.lang_file[0] && global_settings.lang_file[0] != 0xff) + p_lang = global_settings.lang_file; + + while(1) + { + snprintf(talkfile, sizeof(talkfile), LANG_DIR "/InvalidVoice_%s.talk", p_lang); + if (file_exists(talkfile) || p_lang == p_lang_def) + break; /* if it exists or default talk file doesn't exist give up */ + p_lang = p_lang_def; + } if (global_settings.talk_menu && talk_status != TALK_STATUS_OK) { -- cgit v1.2.3