talk: Improvements in voicing "years"

* Enhance LANG_VOICED_DATE_FORMAT to distinguish between "numeric year"
   and "grouped year"  (2020 -> "two thousand twenty" vs "twenty twenty",
   respectively)
 * Metadata year voicing will now use "numeric year" if specified in
   LANG_VOICED_DATE_FORMAT instead of always using grouped year.
 * Datetime year voicing respects the format instead of always using
   "numeric year"

Change-Id: Icc25da7c36107d3e4e8c70291f87a915e2bcabd3
This commit is contained in:
Solomon Peachy 2026-02-24 08:00:29 -05:00
parent c86fd2318d
commit 17edcbd42a
4 changed files with 20 additions and 10 deletions

View file

@ -14666,7 +14666,7 @@
user: core
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
android,hifietma*: "Press BACK to cancel."
cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
@ -14681,7 +14681,7 @@
</source>
<dest>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
android,hifietma*: "Press BACK to cancel."
cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
@ -14696,7 +14696,7 @@
</dest>
<voice>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
android,hifietma*: "Press BACK to cancel."
cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
@ -15191,7 +15191,7 @@
</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"
desc: format string for how dates will be read back. Y == 4-digit year (grouped), y == 4-digit year (numeric), A == month name, m == numeric month, d == numeric day. For example, for 2021-01-05, "AdY" will be voiced as "January 5 twenty twenty-one" and "dmy" will be voiced as "5 1 two thousand twenty one
user: core
<source>
*: "dAY"

View file

@ -15458,7 +15458,7 @@
</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"
desc: format string for how dates will be read back. Y == 4-digit year (grouped), y == 4-digit year (numeric), A == month name, m == numeric month, d == numeric day. For example, for 2021-01-05, "AdY" will be voiced as "January 5 twenty twenty-one" and "dmy" will be voiced as "5 1 two thousand twenty one
user: core
<source>
*: "dAY"

View file

@ -593,21 +593,28 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
if(say_it && val)
talk_spell(val, true);
break;
case LANG_ID3_YEAR:
case LANG_ID3_YEAR: {
const char *format = str(LANG_VOICED_DATE_FORMAT);
bool numericyear = strrchr(format, 'y');
if (id3->year_string)
{
val = id3->year_string;
if(say_it && val)
say_number_and_spell(val, true);
say_number_and_spell(val, !numericyear);
}
else if (id3->year)
{
itoa_buf(buffer, buffer_len, id3->year);
val = buffer;
if(say_it)
talk_value(id3->year, UNIT_DATEYEAR, true);
if(say_it) {
if (numericyear)
talk_number(id3->year, true);
else
talk_value(id3->year, UNIT_DATEYEAR, true);
}
}
break;
}
case LANG_ID3_LENGTH:
length = info->track_ct > 1 ? id3->length : id3->length / 1000;

View file

@ -1566,9 +1566,12 @@ void talk_date(const struct tm *tm, bool enqueue)
for (ptr = format ; *ptr ; ptr++) {
switch(*ptr) {
case 'Y':
case 'y':
talk_number(1900 + tm->tm_year, true);
break;
case 'Y':
talk_year(1900 + tm->tm_year, true);
break;
case 'A':
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
break;