Improve multi (#7136)
[opentx.git] / radio / src / translations / tts_sk.cpp
blob6b18c350ffb6e9d3acf9ce8d8b17c497039528fe
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
59 #define SK_PUSH_UNIT_PROMPT(u, p) sk_pushUnitPrompt((u), (p), id)
61 #define MUZSKY 0x80
62 #define ZENSKY 0x81
63 #define STREDNI 0x82
65 I18N_PLAY_FUNCTION(sk, pushUnitPrompt, uint8_t unitprompt, int16_t number)
67 if (number == 1)
68 PUSH_UNIT_PROMPT(unitprompt, 0);
69 else if (number > 1 && number < 5)
70 PUSH_UNIT_PROMPT(unitprompt, 1);
71 else
72 PUSH_UNIT_PROMPT(unitprompt, 2);
75 I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
78 if (number < 0) {
79 PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
80 number = -number;
84 int8_t mode = MODE(att);
85 if (mode > 0) {
86 if (mode == 2) {
87 number /= 10;
89 div_t qr = div((int)number, 10);
90 if (qr.rem) {
91 PLAY_NUMBER(qr.quot, 0, ZENSKY);
92 if (qr.quot == 0)
93 PUSH_NUMBER_PROMPT(SK_PROMPT_CELA);
94 else
95 SK_PUSH_UNIT_PROMPT(SK_PROMPT_CELA, qr.quot);
96 PLAY_NUMBER(qr.rem, 0, ZENSKY);
97 PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3);
98 return;
100 else {
101 number = qr.quot;
105 int16_t tmp = number;
107 switch(unit) {
108 case 0:
109 break;
110 case 6:
111 case 8:
112 case 10:
113 case 14:
114 case 17:
115 case 21:
116 case 22:
117 case 23:
118 case 24:
119 att = ZENSKY;
120 break;
121 case 13:
122 case 18:
123 att = STREDNI;
124 break;
125 default:
126 att = MUZSKY;
127 break;
130 if ((number == 1) && (att == MUZSKY)) {
131 PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN);
132 number = -1;
135 if ((number == 1) && (att == STREDNI)) {
136 PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO);
137 number = -1;
140 if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) {
141 PUSH_NUMBER_PROMPT(SK_PROMPT_DVE);
142 number = -1;
145 if (number >= 1000) {
146 if (number >= 3000)
147 PLAY_NUMBER(number / 1000, 0, 0);
148 if (number >= 2000 && number < 3000)
149 PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC);
150 else
151 PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC);
153 number %= 1000;
154 if (number == 0)
155 number = -1;
157 if (number >= 100) {
158 PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1);
159 number %= 100;
160 if (number == 0)
161 number = -1;
164 if (number >= 0) {
165 PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number);
168 if (unit) {
169 SK_PUSH_UNIT_PROMPT(unit, tmp);
173 I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT)
175 if (seconds < 0) {
176 PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
177 seconds = -seconds;
180 uint8_t tmp = seconds / 3600;
181 seconds %= 3600;
182 if (tmp > 0 || IS_PLAY_TIME()) {
183 PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY);
186 tmp = seconds / 60;
187 seconds %= 60;
188 if (tmp > 0) {
189 PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY);
192 if (seconds > 0) {
193 PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY);
197 LANGUAGE_PACK_DECLARE(sk, "Slovak");