summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-09-28 21:39:10 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-09-28 21:58:11 -0400
commiteeacffbd15a89870d215fed3d17577bba3fa7116 (patch)
tree91558321dbcf9b76a30c3fb3e756c9a1e207d980
parent70e72e01d24bd6fe1e9ef15bcf3ceeccb69e2d6b (diff)
downloadrockbox-eeacffbd15a89870d215fed3d17577bba3fa7116.tar.gz
rockbox-eeacffbd15a89870d215fed3d17577bba3fa7116.zip
voice: Allow voiced date format to be overridden
This adds LANG_VOICED_DATE_FORMAT, a format string with these tokens: Y 4-digit year A Month name m numeric month d numeric day of month The default (english) is '23 January 2013' In comparison, english-us is 'January 23 2013' Change-Id: I055a3287c104260dec63bba58d36fdae9df1ed16
-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 @@
16027 *: "" 16027 *: ""
16028 </voice> 16028 </voice>
16029</phrase> 16029</phrase>
16030<phrase>
16031 id: LANG_VOICED_DATE_FORMAT
16032 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"
16033 user: core
16034 <source>
16035 *: "dAY"
16036 </source>
16037 <dest>
16038 *: "AdY"
16039 </dest>
16040 <voice>
16041 *: ""
16042 </voice>
16043</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 @@
16094 *: "" 16094 *: ""
16095 </voice> 16095 </voice>
16096</phrase> 16096</phrase>
16097<phrase>
16098 id: LANG_VOICED_DATE_FORMAT
16099 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"
16100 user: core
16101 <source>
16102 *: "dAY"
16103 </source>
16104 <dest>
16105 *: "dAY"
16106 </dest>
16107 <voice>
16108 *: ""
16109 </voice>
16110</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)
1496 1496
1497void talk_date(const struct tm *tm, bool enqueue) 1497void talk_date(const struct tm *tm, bool enqueue)
1498{ 1498{
1499 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, enqueue); 1499 const char *format = str(LANG_VOICED_DATE_FORMAT);
1500 talk_number(tm->tm_mday, true); 1500 const char *ptr;
1501 talk_number(1900 + tm->tm_year, true); 1501
1502 if (!enqueue)
1503 talk_shutup(); /* cut off all the pending stuff */
1504
1505 for (ptr = format ; *ptr ; ptr++) {
1506 switch(*ptr) {
1507 case 'Y':
1508 talk_number(1900 + tm->tm_year, true);
1509 break;
1510 case 'A':
1511 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
1512 break;
1513 case 'm':
1514 talk_number(tm->tm_mon + 1, true);
1515 break;
1516 case 'd':
1517 talk_number(tm->tm_mday, true);
1518 break;
1519 default:
1520 break;
1521 }
1522 }
1502} 1523}
1503 1524
1504void talk_time(const struct tm *tm, bool enqueue) 1525void talk_time(const struct tm *tm, bool enqueue)