Improve multi (#7136)
[opentx.git] / radio / src / translations / tts_fr.cpp
blob57d762db6e8e40a28237ac8f1d1c2a731570aadb
1 /*
2 * Authors (alphabetical order)
3 * - Andre Bernet <bernet.andre@gmail.com>
4 * - Bertrand Songis <bsongis@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 FrenchPrompts {
26 FR_PROMPT_NUMBERS_BASE = 0,
27 FR_PROMPT_ZERO = FR_PROMPT_NUMBERS_BASE+0,
28 FR_PROMPT_CENT = FR_PROMPT_NUMBERS_BASE+100,
29 FR_PROMPT_DEUX_CENT = FR_PROMPT_CENT+1,
30 FR_PROMPT_MILLE = FR_PROMPT_CENT+9,
32 FR_PROMPT_UNE = 110,
33 FR_PROMPT_ONZE,
34 FR_PROMPT_VINGT_ET_UNE,
35 FR_PROMPT_TRENTE_ET_UNE,
36 FR_PROMPT_QUARANTE_ET_UNE,
37 FR_PROMPT_CINQUANTE_ET_UNE,
38 FR_PROMPT_SOIXANTE_ET_UNE,
39 FR_PROMPT_SOIXANTE_ET_ONZE,
40 FR_PROMPT_QUATRE_VINGT_UNE,
42 FR_PROMPT_VIRGULE = 119,
43 FR_PROMPT_ET = 120,
44 FR_PROMPT_MOINS = 121,
45 FR_PROMPT_MINUIT = 122,
46 FR_PROMPT_MIDI = 123,
48 FR_PROMPT_UNITS_BASE = 124,
49 FR_PROMPT_HEURE = FR_PROMPT_UNITS_BASE+UNIT_HOURS,
50 FR_PROMPT_MINUTE = FR_PROMPT_UNITS_BASE+UNIT_MINUTES,
51 FR_PROMPT_SECONDE = FR_PROMPT_UNITS_BASE+UNIT_SECONDS,
52 FR_PROMPT_VIRGULE_BASE = 180, //,0 - ,9
56 #define FR_PUSH_UNIT_PROMPT(u) fr_pushUnitPrompt((u), id)
58 I18N_PLAY_FUNCTION(fr, pushUnitPrompt, uint8_t unitprompt)
60 PUSH_UNIT_PROMPT(unitprompt, 0);
63 #define FEMININ 0x80
65 I18N_PLAY_FUNCTION(fr, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
67 /* if digit >= 1000000000:
68 temp_digit, digit = divmod(digit, 1000000000)
69 prompts.extend(self.getNumberPrompt(temp_digit))
70 prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
71 if digit >= 1000000:
72 temp_digit, digit = divmod(digit, 1000000)
73 prompts.extend(self.getNumberPrompt(temp_digit))
74 prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
77 if (number < 0) {
78 PUSH_NUMBER_PROMPT(FR_PROMPT_MOINS);
79 number = -number;
83 int8_t mode = MODE(att);
84 if (mode > 0) {
85 if (mode == 2) {
86 number /= 10;
88 div_t qr = div((int)number, 10);
89 if (qr.rem) {
90 PLAY_NUMBER(qr.quot, 0, 0);
91 PUSH_NUMBER_PROMPT(FR_PROMPT_VIRGULE_BASE + qr.rem);
92 number = -1;
94 else {
95 number = qr.quot;
99 if (number >= 1000) {
100 if (number >= 2000)
101 PLAY_NUMBER(number / 1000, 0, 0);
102 PUSH_NUMBER_PROMPT(FR_PROMPT_MILLE);
103 number %= 1000;
104 if (number == 0)
105 number = -1;
107 if (number >= 100) {
108 if (number >= 200)
109 PUSH_NUMBER_PROMPT(FR_PROMPT_ZERO + number/100);
110 PUSH_NUMBER_PROMPT(FR_PROMPT_CENT);
111 number %= 100;
112 if (number == 0)
113 number = -1;
115 if (((number % 10) == 1) && number < 90 && (att & FEMININ)) {
116 PUSH_NUMBER_PROMPT(FR_PROMPT_UNE+(number/10));
118 else if (number >= 0) {
119 PUSH_NUMBER_PROMPT(FR_PROMPT_ZERO+number);
122 if (unit) {
123 FR_PUSH_UNIT_PROMPT(unit);
127 I18N_PLAY_FUNCTION(fr, playDuration, int seconds PLAY_DURATION_ATT)
129 if (seconds == 0) {
130 PLAY_NUMBER(0, 0, FEMININ);
131 return;
134 if (seconds < 0) {
135 PUSH_NUMBER_PROMPT(FR_PROMPT_MOINS);
136 seconds = -seconds;
139 uint8_t tmp = seconds / 3600;
140 seconds %= 3600;
141 if (IS_PLAY_TIME() && tmp==0) {
142 PUSH_NUMBER_PROMPT(FR_PROMPT_MINUIT);
144 else if (IS_PLAY_TIME() && tmp==12) {
145 PUSH_NUMBER_PROMPT(FR_PROMPT_MIDI);
147 else if (tmp > 0) {
148 PLAY_NUMBER(tmp, UNIT_HOURS, FEMININ);
151 tmp = seconds / 60;
152 seconds %= 60;
153 if (tmp > 0) {
154 if (IS_PLAY_TIME()) {
155 PLAY_NUMBER(tmp, 0, tmp==1 ? FEMININ : 0);
157 else {
158 PLAY_NUMBER(tmp, UNIT_MINUTES, FEMININ);
159 if (seconds > 0)
160 PUSH_NUMBER_PROMPT(FR_PROMPT_ET);
164 if (!IS_PLAY_TIME() && seconds > 0) {
165 PLAY_NUMBER(seconds, UNIT_SECONDS, FEMININ);
169 LANGUAGE_PACK_DECLARE(fr, "Francais");