1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Solomon Peachy 2023-05-22 10:30:13 -04:00
parent ab0ba139f5
commit 92b80bdba5
6 changed files with 25 additions and 4 deletions

View file

@ -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;
}