summaryrefslogtreecommitdiff
path: root/apps/language.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2023-05-22 10:30:13 -0400
committerSolomon Peachy <pizza@shaftnet.org>2023-05-22 10:30:13 -0400
commit92b80bdba589672b99820a90ad2624d89f555ef1 (patch)
treeaa36f69c7f54a941cfb2d1638f0f04daced99e61 /apps/language.c
parentab0ba139f50a9c9b3eadbe1c15d44ce88cf980d3 (diff)
downloadrockbox-92b80bdba589672b99820a90ad2624d89f555ef1.tar.gz
rockbox-92b80bdba589672b99820a90ad2624d89f555ef1.zip
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
Diffstat (limited to 'apps/language.c')
-rw-r--r--apps/language.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/language.c b/apps/language.c
index 1ad1d5c829..d177303d89 100644
--- a/apps/language.c
+++ b/apps/language.c
@@ -37,7 +37,9 @@
37/* See tools/genlang (TODO: Use common include for both) */ 37/* See tools/genlang (TODO: Use common include for both) */
38#define LANGUAGE_COOKIE 0x1a 38#define LANGUAGE_COOKIE 0x1a
39#define LANGUAGE_VERSION 0x06 39#define LANGUAGE_VERSION 0x06
40#define LANGUAGE_FLAG_RTL 0x01 40
41#define LANGUAGE_FLAG_RTL 0x01
42#define LANGUAGE_FLAG_UNITS_FIRST 0x02
41 43
42#define HEADER_SIZE 4 44#define HEADER_SIZE 4
43#define SUBHEADER_SIZE 6 45#define SUBHEADER_SIZE 6
@@ -54,8 +56,8 @@ void lang_init(const unsigned char *builtin, unsigned char **dest, int count)
54 } 56 }
55} 57}
56 58
57int lang_load(const char *filename, const unsigned char *builtin, 59int lang_load(const char *filename, const unsigned char *builtin,
58 unsigned char **dest, unsigned char *buffer, 60 unsigned char **dest, unsigned char *buffer,
59 unsigned int user_num, int max_lang_size, 61 unsigned int user_num, int max_lang_size,
60 unsigned int max_id) 62 unsigned int max_id)
61{ 63{
@@ -143,3 +145,8 @@ int lang_is_rtl(void)
143{ 145{
144 return (lang_options & LANGUAGE_FLAG_RTL) != 0; 146 return (lang_options & LANGUAGE_FLAG_RTL) != 0;
145} 147}
148
149int lang_units_first(void)
150{
151 return (lang_options & LANGUAGE_FLAG_UNITS_FIRST) != 0;
152}