summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english-us.lang14
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/talk.c27
3 files changed, 52 insertions, 3 deletions
diff --git a/apps/lang/english-us.lang b/apps/lang/english-us.lang
index b926b4e37e..618ee114fd 100644
--- a/apps/lang/english-us.lang
+++ b/apps/lang/english-us.lang
@@ -16027,3 +16027,17 @@
*: ""
</voice>
</phrase>
+<phrase>
+ id: LANG_VOICED_DATE_FORMAT
+ desc: format string for how dates will be read back. Y == 4-digit year, A == month name, m == numeric month, d == numeric day. For example, "AdY" will read "January 21 2021"
+ user: core
+ <source>
+ *: "dAY"
+ </source>
+ <dest>
+ *: "AdY"
+ </dest>
+ <voice>
+ *: ""
+ </voice>
+</phrase>
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 60cb17d245..dab9ed8508 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -16094,3 +16094,17 @@
*: ""
</voice>
</phrase>
+<phrase>
+ id: LANG_VOICED_DATE_FORMAT
+ desc: format string for how dates will be read back. Y == 4-digit year, A == month name, m == numeric month, d == numeric day. For example, "AdY" will read "January 21 2021"
+ user: core
+ <source>
+ *: "dAY"
+ </source>
+ <dest>
+ *: "dAY"
+ </dest>
+ <voice>
+ *: ""
+ </voice>
+</phrase>
diff --git a/apps/talk.c b/apps/talk.c
index e627337162..e440dd98b5 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -1496,9 +1496,30 @@ void talk_setting(const void *global_settings_variable)
void talk_date(const struct tm *tm, bool enqueue)
{
- talk_id(LANG_MONTH_JANUARY + tm->tm_mon, enqueue);
- talk_number(tm->tm_mday, true);
- talk_number(1900 + tm->tm_year, true);
+ const char *format = str(LANG_VOICED_DATE_FORMAT);
+ const char *ptr;
+
+ if (!enqueue)
+ talk_shutup(); /* cut off all the pending stuff */
+
+ for (ptr = format ; *ptr ; ptr++) {
+ switch(*ptr) {
+ case 'Y':
+ talk_number(1900 + tm->tm_year, true);
+ break;
+ case 'A':
+ talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
+ break;
+ case 'm':
+ talk_number(tm->tm_mon + 1, true);
+ break;
+ case 'd':
+ talk_number(tm->tm_mday, true);
+ break;
+ default:
+ break;
+ }
+ }
}
void talk_time(const struct tm *tm, bool enqueue)