Fix doc path
[opentx.git] / radio / src / translations / tts_pl.cpp
blob48cb5554fd7a769fbb61a35b151b46ef73d83403
1 /*
2 * Authors (alphabetical order)
3 * - Bertrand Songis <bsongis@gmail.com>
4 * - Martin Hotar <mhotar@gmail.com>
6 * opentx is based on code named
7 * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
8 * er9x by Erez Raviv: http://code.google.com/p/er9x/,
9 * and the original (and ongoing) project by
10 * Thomas Husterer, th9x: http://code.google.com/p/th9x/
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
23 #include "opentx.h"
25 enum PolishPrompts {
26 PL_PROMPT_NUMBERS_BASE = 0,
27 PL_PROMPT_ZERO = PL_PROMPT_NUMBERS_BASE+0, //0-99
28 PL_PROMPT_STO = PL_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
29 PL_PROMPT_TYSIAC = PL_PROMPT_NUMBERS_BASE+109, //1000
30 PL_PROMPT_TYSIACE = PL_PROMPT_NUMBERS_BASE+110,
31 PL_PROMPT_TYSIECY = PL_PROMPT_NUMBERS_BASE+111,
32 PL_PROMPT_JEDNA = PL_PROMPT_NUMBERS_BASE+112,
33 PL_PROMPT_JEDNO = PL_PROMPT_NUMBERS_BASE+113,
34 PL_PROMPT_DWIE = PL_PROMPT_NUMBERS_BASE+114,
35 PL_PROMPT_CALA = PL_PROMPT_NUMBERS_BASE+115,
36 PL_PROMPT_CALE = PL_PROMPT_NUMBERS_BASE+116,
37 PL_PROMPT_CALYCH = PL_PROMPT_NUMBERS_BASE+117,
38 PL_PROMPT_MINUS = PL_PROMPT_NUMBERS_BASE+118,
39 PL_PROMPT_DZIESIATKI_ZENSKIE=PL_PROMPT_NUMBERS_BASE+120, // 22(0122.wav),32(123.wav),42,52,62,72,82,92(129.wav) - this are special female numbers when the unit is female
41 PL_PROMPT_UNITS_BASE = 160,
42 PL_PROMPT_VOLTS = PL_PROMPT_UNITS_BASE+UNIT_VOLTS, //(jeden)wolt,(dwa)wolty,(piec+)woltów i tak dla wszytkich unitów
43 PL_PROMPT_AMPS = PL_PROMPT_UNITS_BASE+(UNIT_AMPS*4),
44 PL_PROMPT_METERS_PER_SECOND = PL_PROMPT_UNITS_BASE+(UNIT_METERS_PER_SECOND*4),
45 PL_PROMPT_SPARE1 = PL_PROMPT_UNITS_BASE+(UNIT_RAW*4),
46 PL_PROMPT_KMH = PL_PROMPT_UNITS_BASE+(UNIT_SPEED*4),
47 PL_PROMPT_METERS = PL_PROMPT_UNITS_BASE+(UNIT_DIST*4),
48 PL_PROMPT_DEGREES = PL_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*4),
49 PL_PROMPT_PERCENT = PL_PROMPT_UNITS_BASE+(UNIT_PERCENT*4),
50 PL_PROMPT_MILLIAMPS = PL_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*4),
51 PL_PROMPT_MAH = PL_PROMPT_UNITS_BASE+(UNIT_MAH*4),
52 PL_PROMPT_WATTS = PL_PROMPT_UNITS_BASE+(UNIT_WATTS*4),
53 PL_PROMPT_DB = PL_PROMPT_UNITS_BASE+(UNIT_DB*4),
54 PL_PROMPT_FEET = PL_PROMPT_UNITS_BASE+(UNIT_FEET*4),
55 PL_PROMPT_KTS = PL_PROMPT_UNITS_BASE+(UNIT_KTS*4),
56 PL_PROMPT_HOURS = PL_PROMPT_UNITS_BASE+(UNIT_HOURS*4),
57 PL_PROMPT_MINUTES = PL_PROMPT_UNITS_BASE+(UNIT_MINUTES*4),
58 PL_PROMPT_SECONDS = PL_PROMPT_UNITS_BASE+(UNIT_SECONDS*4),
59 PL_PROMPT_RPMS = PL_PROMPT_UNITS_BASE+(UNIT_RPMS*4),
60 PL_PROMPT_G = PL_PROMPT_UNITS_BASE+(UNIT_G*4),
61 #if defined(CPUARM)
62 PL_PROMPT_MILLILITERS = PL_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*4),
63 PL_PROMPT_FLOZ = PL_PROMPT_UNITS_BASE+(UNIT_FLOZ*4),
64 PL_PROMPT_FEET_PER_SECOND = PL_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*4),
65 #endif
68 #if defined(VOICE)
70 #if defined(CPUARM)
71 #define PL_PUSH_UNIT_PROMPT(u, p) pl_pushUnitPrompt((u), (p), id)
72 #else
73 #define PL_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
74 #endif
76 #define MESKI 0x80
77 #define ZENSKI 0x81
78 #define NIJAKI 0x82
80 I18N_PLAY_FUNCTION(pl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
82 #if defined(CPUARM)
83 if (number == 1)
84 PUSH_UNIT_PROMPT(unitprompt, 0);
85 else if (number > 1 && number < 5)
86 PUSH_UNIT_PROMPT(unitprompt, 1);
87 else {
88 int test_2 =0;
89 test_2 =number % 10;
90 int ten=0;
91 ten=(number - (number % 10))/10;
92 if ((test_2 > 1 && test_2 < 5) && ten >=2)
93 PUSH_UNIT_PROMPT(unitprompt, 1);
94 else
95 PUSH_UNIT_PROMPT(unitprompt, 2);
97 #else
98 unitprompt = PL_PROMPT_UNITS_BASE + unitprompt*4;
99 if (number == 1)
100 PUSH_NUMBER_PROMPT(unitprompt);
101 else if (number > 1 && number < 5)
102 PUSH_NUMBER_PROMPT(unitprompt+1);
103 else {
104 int test_2 =0;
105 test_2 =number % 10;
106 int ten=0;
107 ten=(number - (number % 10))/10;
108 if ((test_2 > 1 && test_2 < 5) && ten >=2)
109 PUSH_NUMBER_PROMPT(unitprompt+1);
110 else
111 PUSH_NUMBER_PROMPT(unitprompt+2);
113 #endif
116 I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
119 if (number < 0) {
120 PUSH_NUMBER_PROMPT(PL_PROMPT_MINUS);
121 number = -number;
124 #if !defined(CPUARM)
125 if (unit) {
126 unit--;
127 convertUnit(number, unit);
128 if (IS_IMPERIAL_ENABLE()) {
129 if (unit == UNIT_DIST) {
130 unit = UNIT_FEET;
132 if (unit == UNIT_SPEED) {
133 unit = UNIT_KTS;
136 unit++;
138 #endif
140 int8_t mode = MODE(att);
141 if (mode > 0) {
142 #if defined(CPUARM)
143 if (mode == 2) {
144 number /= 10;
146 #else
147 // we assume that we are PREC1
148 #endif
149 div_t qr = div((int)number, 10);
150 if (qr.rem) {
151 PLAY_NUMBER(qr.quot, 0, ZENSKI);
152 if (qr.quot == 0)
153 PUSH_NUMBER_PROMPT(PL_PROMPT_CALA);
154 else
155 PL_PUSH_UNIT_PROMPT(PL_PROMPT_CALA, qr.quot);
156 PLAY_NUMBER(qr.rem, 0, ZENSKI);
157 PUSH_NUMBER_PROMPT(PL_PROMPT_UNITS_BASE+((unit-1)*4)+3);
158 return;
160 else {
161 number = qr.quot;
165 int16_t tmp = number;
167 switch(unit) {
168 case 0:
169 break;
170 // ft/s
171 case 6:
172 // mph
173 case 8:
174 // feet
175 case 10:
176 //mAh
177 case 14:
178 //flOz
179 case 21:
180 //Hours
181 case 22:
182 //Minutes
183 case 23:
184 //Seconds
185 case 24:
186 att = ZENSKI;
187 break;
188 case 100:
189 att = NIJAKI;
190 break;
191 default:
192 att = MESKI;
193 break;
196 if ((number == 1) && (att == ZENSKI)) {
197 PUSH_NUMBER_PROMPT(PL_PROMPT_JEDNA);
198 number = -1;
201 if ((number == 1) && (att == NIJAKI)) {
202 PUSH_NUMBER_PROMPT(PL_PROMPT_JEDNO);
203 number = -1;
206 if ((number == 2) && (att == ZENSKI)) {
207 PUSH_NUMBER_PROMPT(PL_PROMPT_DWIE);
208 number = -1;
211 if (number >= 1000) {
212 if (number >= 2000)
213 PLAY_NUMBER(number / 1000, 0, 0);
215 if (number >= 2000 && number < 5000)
216 PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIACE);
217 else if (number >= 5000)
218 PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIECY);
219 else
220 PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIAC);
222 number %= 1000;
223 if (number == 0)
224 number = -1;
226 if (number >= 100) {
227 PUSH_NUMBER_PROMPT(PL_PROMPT_STO + (number/100)-1);
228 number %= 100;
229 if (number == 0)
230 number = -1;
233 if (number >= 0) {
234 int test_2 =0;
235 test_2 =number % 10;
236 int ten=0;
237 ten=(number - (number % 10))/10;
238 if (att == ZENSKI && test_2==2 && ten >= 2 ) {
240 PUSH_NUMBER_PROMPT(PL_PROMPT_DZIESIATKI_ZENSKIE+ten);
241 }else
242 PUSH_NUMBER_PROMPT(PL_PROMPT_ZERO+number);
245 if (unit) {
246 PL_PUSH_UNIT_PROMPT(unit, tmp);
251 // The whole funtion has to be changed
252 I18N_PLAY_FUNCTION(pl, playDuration, int seconds PLAY_DURATION_ATT)
254 if (seconds < 0) {
255 PUSH_NUMBER_PROMPT(PL_PROMPT_MINUS);
256 seconds = -seconds;
259 uint8_t tmp = seconds / 3600;
260 seconds %= 3600;
261 if (tmp > 0 || IS_PLAY_TIME()) {
262 PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKI);
265 tmp = seconds / 60;
266 seconds %= 60;
267 if (tmp > 0) {
268 PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKI);
271 if (seconds > 0) {
272 PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKI);
276 LANGUAGE_PACK_DECLARE(pl, "Polish");
278 #endif