Improve multi (#7136)
[opentx.git] / radio / src / translations / tts_pl.cpp
blob4d3be97733aad43c11be84a71f9ea20240982b5f
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 PL_PROMPT_MILLILITERS = PL_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*4),
62 PL_PROMPT_FLOZ = PL_PROMPT_UNITS_BASE+(UNIT_FLOZ*4),
63 PL_PROMPT_FEET_PER_SECOND = PL_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*4),
67 #define PL_PUSH_UNIT_PROMPT(u, p) pl_pushUnitPrompt((u), (p), id)
69 #define MESKI 0x80
70 #define ZENSKI 0x81
71 #define NIJAKI 0x82
73 I18N_PLAY_FUNCTION(pl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
75 if (number == 1)
76 PUSH_UNIT_PROMPT(unitprompt, 0);
77 else if (number > 1 && number < 5)
78 PUSH_UNIT_PROMPT(unitprompt, 1);
79 else {
80 int test_2 =0;
81 test_2 =number % 10;
82 int ten=0;
83 ten=(number - (number % 10))/10;
84 if ((test_2 > 1 && test_2 < 5) && ten >=2)
85 PUSH_UNIT_PROMPT(unitprompt, 1);
86 else
87 PUSH_UNIT_PROMPT(unitprompt, 2);
91 I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
94 if (number < 0) {
95 PUSH_NUMBER_PROMPT(PL_PROMPT_MINUS);
96 number = -number;
100 int8_t mode = MODE(att);
101 if (mode > 0) {
102 if (mode == 2) {
103 number /= 10;
105 div_t qr = div((int)number, 10);
106 if (qr.rem) {
107 PLAY_NUMBER(qr.quot, 0, ZENSKI);
108 if (qr.quot == 0)
109 PUSH_NUMBER_PROMPT(PL_PROMPT_CALA);
110 else
111 PL_PUSH_UNIT_PROMPT(PL_PROMPT_CALA, qr.quot);
112 PLAY_NUMBER(qr.rem, 0, ZENSKI);
113 PUSH_NUMBER_PROMPT(PL_PROMPT_UNITS_BASE+((unit-1)*4)+3);
114 return;
116 else {
117 number = qr.quot;
121 int16_t tmp = number;
123 switch(unit) {
124 case 0:
125 break;
126 // ft/s
127 case 6:
128 // mph
129 case 8:
130 // feet
131 case 10:
132 //mAh
133 case 14:
134 //flOz
135 case 21:
136 //Hours
137 case 22:
138 //Minutes
139 case 23:
140 //Seconds
141 case 24:
142 att = ZENSKI;
143 break;
144 case 100:
145 att = NIJAKI;
146 break;
147 default:
148 att = MESKI;
149 break;
152 if ((number == 1) && (att == ZENSKI)) {
153 PUSH_NUMBER_PROMPT(PL_PROMPT_JEDNA);
154 number = -1;
157 if ((number == 1) && (att == NIJAKI)) {
158 PUSH_NUMBER_PROMPT(PL_PROMPT_JEDNO);
159 number = -1;
162 if ((number == 2) && (att == ZENSKI)) {
163 PUSH_NUMBER_PROMPT(PL_PROMPT_DWIE);
164 number = -1;
167 if (number >= 1000) {
168 if (number >= 2000)
169 PLAY_NUMBER(number / 1000, 0, 0);
171 if (number >= 2000 && number < 5000)
172 PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIACE);
173 else if (number >= 5000)
174 PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIECY);
175 else
176 PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIAC);
178 number %= 1000;
179 if (number == 0)
180 number = -1;
182 if (number >= 100) {
183 PUSH_NUMBER_PROMPT(PL_PROMPT_STO + (number/100)-1);
184 number %= 100;
185 if (number == 0)
186 number = -1;
189 if (number >= 0) {
190 int test_2 =0;
191 test_2 =number % 10;
192 int ten=0;
193 ten=(number - (number % 10))/10;
194 if (att == ZENSKI && test_2==2 && ten >= 2 ) {
196 PUSH_NUMBER_PROMPT(PL_PROMPT_DZIESIATKI_ZENSKIE+ten);
197 }else
198 PUSH_NUMBER_PROMPT(PL_PROMPT_ZERO+number);
201 if (unit) {
202 PL_PUSH_UNIT_PROMPT(unit, tmp);
207 // The whole funtion has to be changed
208 I18N_PLAY_FUNCTION(pl, playDuration, int seconds PLAY_DURATION_ATT)
210 if (seconds < 0) {
211 PUSH_NUMBER_PROMPT(PL_PROMPT_MINUS);
212 seconds = -seconds;
215 uint8_t tmp = seconds / 3600;
216 seconds %= 3600;
217 if (tmp > 0 || IS_PLAY_TIME()) {
218 PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKI);
221 tmp = seconds / 60;
222 seconds %= 60;
223 if (tmp > 0) {
224 PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKI);
227 if (seconds > 0) {
228 PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKI);
232 LANGUAGE_PACK_DECLARE(pl, "Polish");