talk: Improvements in voicing "years"

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 17edcbd42acd41bf020154165f25c37d31bee153
Author: Solomon Peachy <[email protected]>
Date:   Tue Feb 24 08:00:29 2026 -0500

    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

diff --git a/apps/lang/english-us.lang b/apps/lang/english-us.lang
index 1b3a7d83ab..13c1c42bcf 100644
--- a/apps/lang/english-us.lang
+++ b/apps/lang/english-us.lang
@@ -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"
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index e765160385..16b693a0ea 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -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"
diff --git a/apps/screens.c b/apps/screens.c
index 1dd2e396f3..6cbd44c3d4 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -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;
 
diff --git a/apps/talk.c b/apps/talk.c
index a8ca96463d..167c41e6e8 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -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;
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.