Improve multi (#7136)
[opentx.git] / radio / src / translations / tts_se.cpp
blob13b7f69f814de7388035fd7979aa2f11f7bb5765
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 * - Kjell Kernen
12 * - Karl Szmutny
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 SwedishPrompts {
41 SE_PROMPT_NUMBERS_BASE = 0,
42 SE_PROMPT_ZERO = SE_PROMPT_NUMBERS_BASE+0, //02-99
43 SE_PROMPT_HUNDRED = SE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
44 SE_PROMPT_THOUSAND = SE_PROMPT_NUMBERS_BASE+109, //1000
45 SE_PROMPT_AND = SE_PROMPT_NUMBERS_BASE+110,
46 SE_PROMPT_MINUS = SE_PROMPT_NUMBERS_BASE+111,
47 SE_PROMPT_POINT = SE_PROMPT_NUMBERS_BASE+112,
48 SE_PROMPT_UNITS_BASE = 113,
49 SE_PROMPT_POINT_BASE = 165, //.0 - .9
53 #define SE_PUSH_UNIT_PROMPT(u, p) se_pushUnitPrompt((u), (p), id)
55 I18N_PLAY_FUNCTION(se, pushUnitPrompt, uint8_t unitprompt, int16_t number)
57 if (number == 1)
58 PUSH_UNIT_PROMPT(unitprompt, 0);
59 else
60 PUSH_UNIT_PROMPT(unitprompt, 1);
63 I18N_PLAY_FUNCTION(se, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
65 if (number < 0) {
66 PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS);
67 number = -number;
71 int8_t mode = MODE(att);
72 if (mode > 0) {
73 if (mode == 2) {
74 number /= 10;
76 div_t qr = div((int)number, 10);
77 if (qr.rem) {
78 PLAY_NUMBER(qr.quot, 0, 0);
79 PUSH_NUMBER_PROMPT(SE_PROMPT_POINT_BASE + qr.rem);
80 number = -1;
82 else {
83 number = qr.quot;
87 int16_t tmpNumber = number;
89 if (number >= 1000) {
90 PLAY_NUMBER(number / 1000, 0, 0);
91 PUSH_NUMBER_PROMPT(SE_PROMPT_THOUSAND);
92 number %= 1000;
93 if (number == 0)
94 number = -1;
96 if (number >= 100) {
97 PUSH_NUMBER_PROMPT(SE_PROMPT_HUNDRED + (number/100)-1);
98 number %= 100;
99 if (number == 0)
100 number = -1;
102 if (number >= 0) {
103 PUSH_NUMBER_PROMPT(SE_PROMPT_ZERO + number);
106 if (unit) {
107 SE_PUSH_UNIT_PROMPT(unit, tmpNumber);
111 I18N_PLAY_FUNCTION(se, playDuration, int seconds PLAY_DURATION_ATT)
113 if (seconds < 0) {
114 PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS);
115 seconds = -seconds;
118 uint8_t tmp = seconds / 3600;
119 seconds %= 3600;
120 if (tmp > 0 || IS_PLAY_TIME()) {
121 PLAY_NUMBER(tmp, UNIT_HOURS, 0);
124 tmp = seconds / 60;
125 seconds %= 60;
126 if (tmp > 0) {
127 PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
128 if (seconds > 0)
129 PUSH_NUMBER_PROMPT(SE_PROMPT_AND);
132 if (seconds > 0) {
133 PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
137 LANGUAGE_PACK_DECLARE(se, "Swedish");