Improve multi (#7136)
[opentx.git] / radio / src / translations / tts_hu.cpp
blob6b4c1c90fedb67e4996f8e7b6941184149edebd4
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 * - Michael Blandford
13 * - Michal Hlavinka
14 * - Pat Mackenzie
15 * - Philip Moss
16 * - Rob Thomson
17 * - Romolo Manfredini <romolo.manfredini@gmail.com>
18 * - Thomas Husterer
20 * opentx is based on code named
21 * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
22 * er9x by Erez Raviv: http://code.google.com/p/er9x/,
23 * and the original (and ongoing) project by
24 * Thomas Husterer, th9x: http://code.google.com/p/th9x/
26 * This program is free software; you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License version 2 as
28 * published by the Free Software Foundation.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
37 #include "opentx.h"
39 enum HungarianPrompts {
40 HU_PROMPT_NUMBERS_BASE = 0,
41 HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99
42 HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
43 HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000
44 HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110,
45 HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111,
46 HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112,
47 HU_PROMPT_UNITS_BASE = 113,
48 HU_PROMPT_POINT_BASE = 165, //.0 - .9
52 #define HU_PUSH_UNIT_PROMPT(u, p) hu_pushUnitPrompt((u), (p), id)
54 I18N_PLAY_FUNCTION(hu, pushUnitPrompt, uint8_t unitprompt, int16_t number)
56 if (number == 1)
57 PUSH_UNIT_PROMPT(unitprompt, 0);
58 else
59 PUSH_UNIT_PROMPT(unitprompt, 1);
62 I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
64 if (number < 0) {
65 PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
66 number = -number;
70 int8_t mode = MODE(att);
71 if (mode > 0) {
72 if (mode == 2) {
73 number /= 10;
75 div_t qr = div((int)number, 10);
76 if (qr.rem) {
77 PLAY_NUMBER(qr.quot, 0, 0);
78 PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem);
79 number = -1;
81 else {
82 number = qr.quot;
86 int16_t tmp = number;
88 if (number >= 1000) {
89 PLAY_NUMBER(number / 1000, 0, 0);
90 PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND);
91 number %= 1000;
92 if (number == 0)
93 number = -1;
95 if (number >= 100) {
96 PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1);
97 number %= 100;
98 if (number == 0)
99 number = -1;
101 if (number >= 0) {
102 PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number);
105 if (unit) {
106 HU_PUSH_UNIT_PROMPT(unit, tmp);
110 I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT)
112 if (seconds == 0) {
113 PLAY_NUMBER(seconds, 0, 0);
114 return;
117 if (seconds < 0) {
118 PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
119 seconds = -seconds;
122 uint8_t tmp = seconds / 3600;
123 seconds %= 3600;
124 if (tmp > 0 || IS_PLAY_TIME()) {
125 PLAY_NUMBER(tmp, UNIT_HOURS, 0);
128 tmp = seconds / 60;
129 seconds %= 60;
130 if (tmp > 0) {
131 PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
132 // This is not necessary in the Hungarian
133 //if (seconds > 0)
134 //PUSH_NUMBER_PROMPT(HU_PROMPT_AND);
137 if (seconds > 0) {
138 PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
142 LANGUAGE_PACK_DECLARE(hu, "Hungarian");