From 92b80bdba589672b99820a90ad2624d89f555ef1 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Mon, 22 May 2023 10:30:13 -0400 Subject: lang: Support languages that speak the units before a numerical value Previously, it was hardcoded to the english convention of units-last, so "100%" would be voiced as "one hundred percent". This adds a new language flag that makes the units be voiced first, ie "100%" will be voiced as "percent one hundred". So far only the Chinese-traditional and Chinese-simplified languages utilize this feature (taken from an old ticket, FS#10340) but I'm sure others would want this feature too. Change-Id: Idf825ec9299dc0ed09921cf67aec61b1ab262fc6 --- apps/talk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apps/talk.c') diff --git a/apps/talk.c b/apps/talk.c index 2ef7fea84d..5d6e7ac0b6 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -35,6 +35,7 @@ #include "voice_thread.h" #include "audio.h" #include "lang.h" +#include "language.h" #include "talk.h" #include "metadata.h" /*#define LOGF_ENABLE*/ @@ -1419,8 +1420,11 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) return 0; } + if (lang_units_first()) + talk_id(unit_id, true); /* say the unit, if any */ talk_number(n, enqueue); /* say the number */ - talk_id(unit_id, true); /* say the unit, if any */ + if (!lang_units_first()) + talk_id(unit_id, true); /* say the unit, if any */ return 0; } -- cgit v1.2.3