Fix doc path
[opentx.git] / radio / src / translations / tts_sk.cpp
blobabfa77c9de12de7ba6625716d4d02ee122aea17f
1 /*
2 * Authors (alphabetical order)
3 * - Andre Bernet <bernet.andre@gmail.com>
4 * - Andreas Weitl
5 * - Bertrand Songis <bsongis@gmail.com>
6 * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
7 * - Cameron Weeks <th9xer@gmail.com>
8 * - Erez Raviv
9 * - Gabriel Birkus
10 * - Jean-Pierre Parisy
11 * - Karl Szmutny
12 * - Martin Hotar
13 * - Michael Blandford
14 * - Michal Hlavinka
15 * - Pat Mackenzie
16 * - Philip Moss
17 * - Rob Thomson
18 * - Romolo Manfredini <romolo.manfredini@gmail.com>
19 * - Thomas Husterer
21 * opentx is based on code named
22 * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
23 * er9x by Erez Raviv: http://code.google.com/p/er9x/,
24 * and the original (and ongoing) project by
25 * Thomas Husterer, th9x: http://code.google.com/p/th9x/
27 * This program is free software; you can redistribute it and/or modify
28 * it under the terms of the GNU General Public License version 2 as
29 * published by the Free Software Foundation.
31 * This program is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 * GNU General Public License for more details.
38 #include "opentx.h"
40 enum SlovakPrompts {
41 SK_PROMPT_NUMBERS_BASE = 0,
42 SK_PROMPT_NULA = SK_PROMPT_NUMBERS_BASE+0, //0-99
43 SK_PROMPT_STO = SK_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
44 SK_PROMPT_TISIC = SK_PROMPT_NUMBERS_BASE+109, //1000
45 SK_PROMPT_DVETISIC = SK_PROMPT_NUMBERS_BASE+110,
46 SK_PROMPT_JEDEN = SK_PROMPT_NUMBERS_BASE+111,
47 SK_PROMPT_JEDNO = SK_PROMPT_NUMBERS_BASE+112,
48 SK_PROMPT_DVE = SK_PROMPT_NUMBERS_BASE+113,
49 SK_PROMPT_CELA = SK_PROMPT_NUMBERS_BASE+114,
50 SK_PROMPT_CELE = SK_PROMPT_NUMBERS_BASE+115,
51 SK_PROMPT_CELYCH = SK_PROMPT_NUMBERS_BASE+116,
52 SK_PROMPT_MINUS = SK_PROMPT_NUMBERS_BASE+117,
54 SK_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu
58 #if defined(VOICE)
60 #if defined(CPUARM)
61 #define SK_PUSH_UNIT_PROMPT(u, p) sk_pushUnitPrompt((u), (p), id)
62 #else
63 #define SK_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
64 #endif
66 #define MUZSKY 0x80
67 #define ZENSKY 0x81
68 #define STREDNI 0x82
70 I18N_PLAY_FUNCTION(sk, pushUnitPrompt, uint8_t unitprompt, int16_t number)
72 #if defined(CPUARM)
73 if (number == 1)
74 PUSH_UNIT_PROMPT(unitprompt, 0);
75 else if (number > 1 && number < 5)
76 PUSH_UNIT_PROMPT(unitprompt, 1);
77 else
78 PUSH_UNIT_PROMPT(unitprompt, 2);
79 #else
80 unitprompt = SK_PROMPT_UNITS_BASE + unitprompt*4;
81 if (number == 1)
82 PUSH_NUMBER_PROMPT(unitprompt);
83 else if (number > 1 && number < 5)
84 PUSH_NUMBER_PROMPT(unitprompt+1);
85 else
86 PUSH_NUMBER_PROMPT(unitprompt+2);
87 #endif
90 I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
93 if (number < 0) {
94 PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
95 number = -number;
98 #if !defined(CPUARM)
99 if (unit) {
100 unit--;
101 convertUnit(number, unit);
102 if (IS_IMPERIAL_ENABLE()) {
103 if (unit == UNIT_DIST) {
104 unit = UNIT_FEET;
106 if (unit == UNIT_SPEED) {
107 unit = UNIT_KTS;
110 unit++;
112 #endif
114 int8_t mode = MODE(att);
115 if (mode > 0) {
116 #if defined(CPUARM)
117 if (mode == 2) {
118 number /= 10;
120 #else
121 // we assume that we are PREC1
122 #endif
123 div_t qr = div((int)number, 10);
124 if (qr.rem) {
125 PLAY_NUMBER(qr.quot, 0, ZENSKY);
126 if (qr.quot == 0)
127 PUSH_NUMBER_PROMPT(SK_PROMPT_CELA);
128 else
129 SK_PUSH_UNIT_PROMPT(SK_PROMPT_CELA, qr.quot);
130 PLAY_NUMBER(qr.rem, 0, ZENSKY);
131 PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3);
132 return;
134 else {
135 number = qr.quot;
139 int16_t tmp = number;
141 #if defined(CPUARM)
142 switch(unit) {
143 case 0:
144 break;
145 case 6:
146 case 8:
147 case 10:
148 case 14:
149 case 17:
150 case 21:
151 case 22:
152 case 23:
153 case 24:
154 att = ZENSKY;
155 break;
156 case 13:
157 case 18:
158 att = STREDNI;
159 break;
160 default:
161 att = MUZSKY;
162 break;
164 #else
165 switch(unit) {
166 case 0:
167 break;
168 case 4:
169 case 10:
170 case 13:
171 case 14:
172 case 15:
173 case 16:
174 case 17:
175 case 18:
176 att = ZENSKY;
177 break;
178 case 8:
179 case 19:
180 att = STREDNI;
181 break;
182 default:
183 att = MUZSKY;
184 break;
186 #endif
188 if ((number == 1) && (att == MUZSKY)) {
189 PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN);
190 number = -1;
193 if ((number == 1) && (att == STREDNI)) {
194 PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO);
195 number = -1;
198 if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) {
199 PUSH_NUMBER_PROMPT(SK_PROMPT_DVE);
200 number = -1;
203 if (number >= 1000) {
204 if (number >= 3000)
205 PLAY_NUMBER(number / 1000, 0, 0);
206 if (number >= 2000 && number < 3000)
207 PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC);
208 else
209 PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC);
211 number %= 1000;
212 if (number == 0)
213 number = -1;
215 if (number >= 100) {
216 PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1);
217 number %= 100;
218 if (number == 0)
219 number = -1;
222 if (number >= 0) {
223 PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number);
226 if (unit) {
227 SK_PUSH_UNIT_PROMPT(unit, tmp);
231 I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT)
233 if (seconds < 0) {
234 PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
235 seconds = -seconds;
238 uint8_t tmp = seconds / 3600;
239 seconds %= 3600;
240 if (tmp > 0 || IS_PLAY_TIME()) {
241 PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY);
244 tmp = seconds / 60;
245 seconds %= 60;
246 if (tmp > 0) {
247 PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY);
250 if (seconds > 0) {
251 PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY);
255 LANGUAGE_PACK_DECLARE(sk, "Slovak");
257 #endif