diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/chinese-simp.lang | 2 | ||||
-rw-r--r-- | apps/lang/chinese-trad.lang | 2 | ||||
-rw-r--r-- | apps/language.c | 13 | ||||
-rw-r--r-- | apps/language.h | 2 | ||||
-rw-r--r-- | apps/talk.c | 6 |
5 files changed, 21 insertions, 4 deletions
diff --git a/apps/lang/chinese-simp.lang b/apps/lang/chinese-simp.lang index 3d1d0ecaa3..b7702ee3c7 100644 --- a/apps/lang/chinese-simp.lang +++ b/apps/lang/chinese-simp.lang | |||
@@ -13,6 +13,8 @@ | |||
13 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | 13 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
14 | # KIND, either express or implied. | 14 | # KIND, either express or implied. |
15 | # | 15 | # |
16 | # LANGUAGE_UNITS_FIRST | ||
17 | # | ||
16 | # Simplified Chinese language file, translated by: | 18 | # Simplified Chinese language file, translated by: |
17 | # - Ye Wei | 19 | # - Ye Wei |
18 | # - Xinlu Huang | 20 | # - Xinlu Huang |
diff --git a/apps/lang/chinese-trad.lang b/apps/lang/chinese-trad.lang index 02e14645e0..e7ee7ae607 100644 --- a/apps/lang/chinese-trad.lang +++ b/apps/lang/chinese-trad.lang | |||
@@ -13,6 +13,8 @@ | |||
13 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | 13 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
14 | # KIND, either express or implied. | 14 | # KIND, either express or implied. |
15 | # | 15 | # |
16 | # LANGUAGE_UNITS_FIRST | ||
17 | # | ||
16 | # Traditional Chinese language file, translated by: | 18 | # Traditional Chinese language file, translated by: |
17 | # - Wenbin Leo | 19 | # - Wenbin Leo |
18 | # - Xinlu Huang | 20 | # - Xinlu Huang |
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 | ||
57 | int lang_load(const char *filename, const unsigned char *builtin, | 59 | int 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 | |||
149 | int lang_units_first(void) | ||
150 | { | ||
151 | return (lang_options & LANGUAGE_FLAG_UNITS_FIRST) != 0; | ||
152 | } | ||
diff --git a/apps/language.h b/apps/language.h index cbfa7e2c1d..85fa7f6efa 100644 --- a/apps/language.h +++ b/apps/language.h | |||
@@ -37,4 +37,6 @@ int lang_english_to_id(const char *english); | |||
37 | 37 | ||
38 | /* returns whether the loaded language is a right-to-left language */ | 38 | /* returns whether the loaded language is a right-to-left language */ |
39 | int lang_is_rtl(void); | 39 | int lang_is_rtl(void); |
40 | /* returns whether the loaded language needs units spoken before the value */ | ||
41 | int lang_units_first(void); | ||
40 | #endif | 42 | #endif |
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 @@ | |||
35 | #include "voice_thread.h" | 35 | #include "voice_thread.h" |
36 | #include "audio.h" | 36 | #include "audio.h" |
37 | #include "lang.h" | 37 | #include "lang.h" |
38 | #include "language.h" | ||
38 | #include "talk.h" | 39 | #include "talk.h" |
39 | #include "metadata.h" | 40 | #include "metadata.h" |
40 | /*#define LOGF_ENABLE*/ | 41 | /*#define LOGF_ENABLE*/ |
@@ -1419,8 +1420,11 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) | |||
1419 | return 0; | 1420 | return 0; |
1420 | } | 1421 | } |
1421 | 1422 | ||
1423 | if (lang_units_first()) | ||
1424 | talk_id(unit_id, true); /* say the unit, if any */ | ||
1422 | talk_number(n, enqueue); /* say the number */ | 1425 | talk_number(n, enqueue); /* say the number */ |
1423 | talk_id(unit_id, true); /* say the unit, if any */ | 1426 | if (!lang_units_first()) |
1427 | talk_id(unit_id, true); /* say the unit, if any */ | ||
1424 | 1428 | ||
1425 | return 0; | 1429 | return 0; |
1426 | } | 1430 | } |