3 * - Alexander Novikov (mr.pokryshkin@gmail.com)
5 * tts_ru is based on tts_de and tts_en
7 * opentx is based on code named
8 * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
9 * er9x by Erez Raviv: http://code.google.com/p/er9x/,
10 * and the original (and ongoing) project by
11 * Thomas Husterer, th9x: http://code.google.com/p/th9x/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
27 RU_PROMPT_NUMBERS_BASE
= 0,
28 RU_PROMPT_ZERO
= RU_PROMPT_NUMBERS_BASE
+0, //02-99
29 RU_PROMPT_HUNDRED
= RU_PROMPT_NUMBERS_BASE
+100, //100,200 .. 900
31 RU_PROMPT_AND
= RU_PROMPT_NUMBERS_BASE
+110, // и
32 RU_PROMPT_MINUS
= RU_PROMPT_NUMBERS_BASE
+111, // минус
33 RU_PROMPT_UNITS_BASE
= RU_PROMPT_NUMBERS_BASE
+ 113,
34 RU_PROMPT_POINT_BASE
= RU_PROMPT_NUMBERS_BASE
+ 165, //.0 - .9
35 RU_PROMPT_FEMALE_ONE
= RU_PROMPT_NUMBERS_BASE
+ 180,
36 RU_PROMPT_FEMALE_TWO
= RU_PROMPT_NUMBERS_BASE
+ 190,
38 RU_PROMPT_THOUSAND1
= RU_PROMPT_NUMBERS_BASE
+200, //1000
39 RU_PROMPT_THOUSAND2
= RU_PROMPT_NUMBERS_BASE
+201, //2000
40 RU_PROMPT_THOUSAND5
= RU_PROMPT_NUMBERS_BASE
+202, //5000
44 #define RU_FEMALE_UNIT 0xFF
47 #define RU_PUSH_UNIT_PROMPT(u, p) ru_pushUnitPrompt((u), (p), id)
49 I18N_PLAY_FUNCTION(ru
, pushUnitPrompt
, uint8_t unitprompt
, int16_t number
)
51 if (number
< 0){ // if negative number, we have to use 2 units form (for example value = 1.3)
52 PUSH_UNIT_PROMPT(unitprompt
, 2);
55 int16_t mod10
= number
% 10;
57 PUSH_UNIT_PROMPT(unitprompt
, 0);
59 PUSH_UNIT_PROMPT(unitprompt
, 1);
60 else if (number
>=2 && number
<=4)
61 PUSH_UNIT_PROMPT(unitprompt
, 2);
62 else if (number
>=5 && number
<=20)
63 PUSH_UNIT_PROMPT(unitprompt
, 5);
65 PUSH_UNIT_PROMPT(unitprompt
, 1);
66 else if (mod10
>= 2 && mod10
<=4)
67 PUSH_UNIT_PROMPT(unitprompt
, 2);
69 PUSH_UNIT_PROMPT(unitprompt
, 5);
73 I18N_PLAY_FUNCTION(ru
, playNumber
, getvalue_t number
, uint8_t unit
, uint8_t att
)
76 PUSH_NUMBER_PROMPT(RU_PROMPT_MINUS
);
80 div_t qr
= div((int)number
, 10);
81 int8_t mode
= MODE(att
);
82 if (mode
> 0 && att
!= RU_FEMALE_UNIT
) {
87 PLAY_NUMBER(qr
.quot
, 0, 0);
88 PUSH_NUMBER_PROMPT(RU_PROMPT_POINT_BASE
+ qr
.rem
);
99 PLAY_NUMBER(number
/ 1000, RU_FEMALE_UNIT
, 0); // female
100 uint8_t thousands
= number
/ 1000;
101 int16_t mod10
= thousands
% 10;
103 PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND1
);
104 else if (thousands
>=2 && thousands
<=4)
105 PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND2
);
106 else if (thousands
>=5 && thousands
<=20)
107 PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND5
);
109 PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND1
);
110 else if (mod10
>= 2 && mod10
<=4)
111 PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND2
);
113 PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND5
);
119 PUSH_NUMBER_PROMPT(RU_PROMPT_HUNDRED
+ (number
/100)-1);
138 uint8_t lastDigit
= number
% 10;
139 uint8_t ten
=(number
- (number
% 10))/10;
140 if (lastDigit
== 1 && number
!= 11 && attr
== FEMALE
)
141 PUSH_NUMBER_PROMPT(RU_PROMPT_FEMALE_ONE
+ ten
);
142 else if (lastDigit
== 2 && number
!=12 && attr
== FEMALE
)
143 PUSH_NUMBER_PROMPT(RU_PROMPT_FEMALE_TWO
+ ten
);
145 PUSH_NUMBER_PROMPT(RU_PROMPT_ZERO
+ number
);
149 if (mode
> 0 && qr
.rem
) // number with decimal point
150 RU_PUSH_UNIT_PROMPT(unit
, -1); // force 2 units form, if float value
152 RU_PUSH_UNIT_PROMPT(unit
, tmp
);
156 I18N_PLAY_FUNCTION(ru
, playDuration
, int seconds PLAY_DURATION_ATT
)
159 PLAY_NUMBER(seconds
, 0, 0);
164 PUSH_NUMBER_PROMPT(RU_PROMPT_MINUS
);
168 uint8_t tmp
= seconds
/ 3600;
170 if (tmp
> 0 || IS_PLAY_TIME()) {
171 PLAY_NUMBER(tmp
, UNIT_HOURS
, 0);
177 PLAY_NUMBER(tmp
, UNIT_MINUTES
, 0);
179 PUSH_NUMBER_PROMPT(RU_PROMPT_AND
);
182 PLAY_NUMBER(seconds
, UNIT_SECONDS
, 0);
186 LANGUAGE_PACK_DECLARE(ru
, "Russian");