chore: improve translation string management (#6502)

This commit is contained in:
philmoz
2025-10-05 13:04:17 +10:00
committed by GitHub
parent 92b0637b01
commit 6a37b3d4bc
129 changed files with 9883 additions and 6544 deletions
+107
View File
@@ -0,0 +1,107 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#pragma once
#include "audio.h"
struct LanguagePack {
const char * id;
const char * name;
void (*playNumber)(getvalue_t number, uint8_t unit, uint8_t flags, uint8_t id, int8_t fragmentVolume);
void (*playDuration)(int seconds, uint8_t flags, uint8_t id, int8_t fragmentVolume);
};
extern const LanguagePack * currentLanguagePack;
extern uint8_t currentLanguagePackIdx;
extern const LanguagePack czLanguagePack;
extern const LanguagePack daLanguagePack;
extern const LanguagePack deLanguagePack;
extern const LanguagePack enLanguagePack;
extern const LanguagePack esLanguagePack;
extern const LanguagePack frLanguagePack;
extern const LanguagePack huLanguagePack;
extern const LanguagePack itLanguagePack;
extern const LanguagePack nlLanguagePack;
extern const LanguagePack plLanguagePack;
extern const LanguagePack ptLanguagePack;
extern const LanguagePack ruLanguagePack;
extern const LanguagePack seLanguagePack;
extern const LanguagePack skLanguagePack;
extern const LanguagePack cnLanguagePack;
extern const LanguagePack jpLanguagePack;
extern const LanguagePack koLanguagePack;
extern const LanguagePack ruLanguagePack;
extern const LanguagePack heLanguagePack;
extern const LanguagePack uaLanguagePack;
extern const LanguagePack * const languagePacks[];
#if defined(LANGUAGE_PACKS_DEFINITION)
const LanguagePack * const languagePacks[] = {
// alphabetical order
&cnLanguagePack,
&czLanguagePack,
&daLanguagePack,
&deLanguagePack,
&enLanguagePack,
&esLanguagePack,
&frLanguagePack,
&heLanguagePack,
&huLanguagePack,
&itLanguagePack,
&jpLanguagePack,
&koLanguagePack,
&nlLanguagePack,
&plLanguagePack,
&ptLanguagePack,
&ruLanguagePack,
&seLanguagePack,
&skLanguagePack,
&uaLanguagePack,
NULL
};
#endif
#if defined(SIMU)
#define LANGUAGE_PACK_DECLARE(lng, name) \
const LanguagePack lng##LanguagePack = {#lng, name, lng##_##playNumber, \
lng##_##playDuration}
#else
#define LANGUAGE_PACK_DECLARE(lng, name) \
extern const LanguagePack lng##LanguagePack = { \
#lng, name, lng##_##playNumber, lng##_##playDuration}
#endif
#define LANGUAGE_PACK_DECLARE_DEFAULT(lng, name) \
LANGUAGE_PACK_DECLARE(lng, name); \
const LanguagePack* currentLanguagePack = &lng##LanguagePack; \
uint8_t currentLanguagePackIdx
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id, int8_t fragmentVolume = USE_SETTINGS_VOLUME)
inline PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t flags) {
currentLanguagePack->playNumber(number, unit, flags, id, fragmentVolume);
}
inline PLAY_FUNCTION(playDuration, int seconds, uint8_t flags) {
currentLanguagePack->playDuration(seconds, flags, id, fragmentVolume);
}
+133
View File
@@ -0,0 +1,133 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum ChinesePrompts {
CN_PROMPT_NUMBERS_BASE = 0,
CN_PROMPT_ZERO = CN_PROMPT_NUMBERS_BASE+0, //02-99
CN_PROMPT_HUNDRED = CN_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
CN_PROMPT_THOUSAND = CN_PROMPT_NUMBERS_BASE+109, //1000
CN_PROMPT_AND = CN_PROMPT_NUMBERS_BASE+110,
CN_PROMPT_MINUS = CN_PROMPT_NUMBERS_BASE+111,
CN_PROMPT_POINT = CN_PROMPT_NUMBERS_BASE+112,
CN_PROMPT_UNITS_BASE = 113,
CN_PROMPT_POINT_BASE = 167, //.0 - .9
};
#define CN_PUSH_UNIT_PROMPT(u, p) cn_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(cn, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(cn, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(CN_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(CN_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(CN_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(CN_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(CN_PROMPT_ZERO + number);
}
if (unit) {
CN_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(cn, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(CN_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(CN_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(cn, STR_VOICE_CHINESE);
+190
View File
@@ -0,0 +1,190 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum CzechPrompts {
CZ_PROMPT_NUMBERS_BASE = 0,
CZ_PROMPT_NULA = CZ_PROMPT_NUMBERS_BASE+0, // 0-99
CZ_PROMPT_STO = CZ_PROMPT_NUMBERS_BASE+100, // 100,200 .. 900
CZ_PROMPT_TISIC = CZ_PROMPT_NUMBERS_BASE+109, // 1000
CZ_PROMPT_TISICE = CZ_PROMPT_NUMBERS_BASE+110,
CZ_PROMPT_JEDEN = CZ_PROMPT_NUMBERS_BASE+111,
CZ_PROMPT_JEDNO = CZ_PROMPT_NUMBERS_BASE+112,
CZ_PROMPT_DVE = CZ_PROMPT_NUMBERS_BASE+113,
CZ_PROMPT_CELA = CZ_PROMPT_NUMBERS_BASE+114,
CZ_PROMPT_CELE = CZ_PROMPT_NUMBERS_BASE+115,
CZ_PROMPT_CELYCH = CZ_PROMPT_NUMBERS_BASE+116,
CZ_PROMPT_MINUS = CZ_PROMPT_NUMBERS_BASE+117,
CZ_PROMPT_UNITS_BASE = 118, // (jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu
};
#define CZ_PUSH_UNIT_PROMPT(u, p) cz_pushUnitPrompt((u), (p), id, fragmentVolume)
#define MALE 0x80
#define FEMALE 0x81
#define NEUTRAL 0x82
I18N_PLAY_FUNCTION(cz, pushUnitPrompt, uint8_t unit, int16_t number)
{
TRACE("CZSAY unit:%d number:%d", unit, number);
if (number == 1)
PUSH_UNIT_PROMPT(unit, 0);
else if (number > 1 && number < 5)
PUSH_UNIT_PROMPT(unit, 1);
else
PUSH_UNIT_PROMPT(unit, 2);
}
I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, FEMALE);
if (qr.quot < 2) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_CELA);
}
else if (qr.quot > 1 && qr.quot < 5) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_CELE);
}
else {
PUSH_NUMBER_PROMPT(CZ_PROMPT_CELYCH);
};
PLAY_NUMBER(qr.rem, 0, FEMALE);
PUSH_UNIT_PROMPT(unit, 3);
return;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
switch(unit) {
case UNIT_RAW:
break;
case UNIT_FEET_PER_SECOND:
case UNIT_MPH:
case UNIT_FEET:
case UNIT_MAH:
case UNIT_RPMS:
case UNIT_FLOZ:
case UNIT_HOURS:
case UNIT_MINUTES:
case UNIT_SECONDS:
att = FEMALE;
break;
case UNIT_PERCENT:
case UNIT_G:
att = NEUTRAL;
break;
default:
att = MALE;
break;
}
if ((number == 1) && (att == MALE)) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDEN);
number = -1;
}
if ((number == 1) && (att == NEUTRAL)) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDNO);
number = -1;
}
if ((number == 2) && ((att == FEMALE) || (att == NEUTRAL))) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_DVE);
number = -1;
}
if (number >= 1000) {
if (number >= 2000)
PLAY_NUMBER(number / 1000, 0, 0);
if (number >= 2000 && number < 5000)
PUSH_NUMBER_PROMPT(CZ_PROMPT_TISICE);
else
PUSH_NUMBER_PROMPT(CZ_PROMPT_TISIC);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_STO + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_NULA+number);
}
if (unit) {
CZ_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(cz, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, FEMALE);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, FEMALE);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, FEMALE);
}
}
LANGUAGE_PACK_DECLARE(cz, STR_VOICE_CZECH);
+128
View File
@@ -0,0 +1,128 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum DanishPrompts {
DA_PROMPT_NUMBERS_BASE = 0,
DA_PROMPT_ZERO = DA_PROMPT_NUMBERS_BASE+0, //02-99
DA_PROMPT_HUNDRED = DA_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
DA_PROMPT_THOUSAND = DA_PROMPT_NUMBERS_BASE+109, //1000
DA_PROMPT_AND = DA_PROMPT_NUMBERS_BASE+110,
DA_PROMPT_MINUS = DA_PROMPT_NUMBERS_BASE+111,
DA_PROMPT_POINT = DA_PROMPT_NUMBERS_BASE+112,
DA_PROMPT_UNITS_BASE = 113,
DA_PROMPT_POINT_BASE = 165, //.0 - .9
};
#define DA_PUSH_UNIT_PROMPT(u, p) da_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(da, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(da, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(DA_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(DA_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmpNumber = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(DA_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(DA_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(DA_PROMPT_ZERO + number);
}
if (unit) {
DA_PUSH_UNIT_PROMPT(unit, tmpNumber);
}
}
I18N_PLAY_FUNCTION(da, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(DA_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(DA_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(da, STR_VOICE_DANISH);
+174
View File
@@ -0,0 +1,174 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum GermanPrompts {
DE_PROMPT_NUMBERS_BASE = 0,
DE_PROMPT_NULL = DE_PROMPT_NUMBERS_BASE+0,
DE_PROMPT_EIN = DE_PROMPT_NUMBERS_BASE+100,
DE_PROMPT_EINE = DE_PROMPT_NUMBERS_BASE+101,
DE_PROMPT_HUNDERT = DE_PROMPT_NUMBERS_BASE+102,
DE_PROMPT_TAUSEND = DE_PROMPT_NUMBERS_BASE+103,
DE_PROMPT_COMMA = 104,
DE_PROMPT_UND,
DE_PROMPT_MINUS,
};
static inline bool hasDualUnits(uint8_t unit) { // true if unit has a secondary unit for value 1
return (unit == UNIT_HOURS || // example with sec. unit: "null Stunden", "eine Stunde", "zwei Stunden", ...
unit == UNIT_MINUTES || // exmple without sec. unit "null Volt", "ein Volt", "zwei Volt", ...
unit == UNIT_SECONDS ||
unit == UNIT_FLOZ ||
unit == UNIT_MS ||
unit == UNIT_US ||
unit == UNIT_MPH ||
unit == UNIT_RPMS ||
unit == UNIT_MAH ||
unit == UNIT_RADIANS); // sepcial case for value 1: "ein Radiant", not "eine Radiant"
}
#define DE_PUSH_UNIT_PROMPT(u, p) de_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(de, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if(number != 1 && hasDualUnits(unitprompt))
PUSH_UNIT_PROMPT(unitprompt, 1); // value is not 1 and unit has secondary unit -> <unit>1.wav for secondary unit (plural)
else
PUSH_UNIT_PROMPT(unitprompt, 0); // value is 1 or unit has no secondary unit -> push <unit>0.wav for primary unit (singular)
}
I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_COMMA);
PUSH_NUMBER_PROMPT(DE_PROMPT_NUMBERS_BASE + qr.rem);
number = -1; // force secondary unit if unit has one
// skips the following integer processing
}
else {
number = qr.quot; // no remainder, continue with integer part
}
}
if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND);
number %= 1000;
if (number == 0)
number = -1;
}
if ((number >= 1000) && (number < 2000)) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EIN);
PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND);
number %= 1000;
if (number == 0)
number = -1;
}
if ((number >= 200) && (number < 1000)) {
PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 100);
PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT);
number %= 100;
if (number == 0)
number = -1;
}
if ((number >= 100) && (number < 200)) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EIN);
PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
if (number == 1) {
if(unit) {
if(hasDualUnits(unit) && unit != UNIT_RADIANS)
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); // value is 1, has unit and unit has secondary unit -> "eine",
// except radians -> "ein"
else
PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); // value is 1, has unit and unit has no secondary unit -> "ein"
// or unit is radians (which has secondary unit but German ...)
} else
PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + 1); // value is 1, has no unit -> regular number "eins"
} else
PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number); // value is not 1, has no unit or unit has
// no secondary unit -> regular number
}
if(unit)
DE_PUSH_UNIT_PROMPT(unit, number);
}
I18N_PLAY_FUNCTION(de, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(de, STR_VOICE_DEUTSCH);
+134
View File
@@ -0,0 +1,134 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum EnglishPrompts {
EN_PROMPT_NUMBERS_BASE = 0,
EN_PROMPT_ZERO = EN_PROMPT_NUMBERS_BASE+0, //02-99
EN_PROMPT_HUNDRED = EN_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
EN_PROMPT_THOUSAND = EN_PROMPT_NUMBERS_BASE+109, //1000
EN_PROMPT_AND = EN_PROMPT_NUMBERS_BASE+110,
EN_PROMPT_MINUS = EN_PROMPT_NUMBERS_BASE+111,
EN_PROMPT_POINT = EN_PROMPT_NUMBERS_BASE+112,
EN_PROMPT_UNITS_BASE = 113,
EN_PROMPT_POINT_BASE = 167, //.0 - .9
};
#define EN_PUSH_UNIT_PROMPT(u, p) en_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(en, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
TRACE("I18N_PLAY_FUNCTION v %d", fragmentVolume);
if (number < 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(EN_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(EN_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(EN_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_ZERO + number);
}
if (unit) {
EN_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(en, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(EN_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE_DEFAULT(en, STR_VOICE_ENGLISH);
+198
View File
@@ -0,0 +1,198 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum SpanishPrompts {
ES_PROMPT_NUMBERS_BASE = 0,
ES_PROMPT_ZERO = ES_PROMPT_NUMBERS_BASE+0,
ES_PROMPT_CIEN = ES_PROMPT_NUMBERS_BASE+100,
ES_PROMPT_CIENTO = ES_PROMPT_NUMBERS_BASE+101,
ES_PROMPT_DOSCIENTOS = ES_PROMPT_NUMBERS_BASE+102,
ES_PROMPT_TRESCIENTOS,
ES_PROMPT_CUATROCIENTOS,
ES_PROMPT_QUINIENTOS,
ES_PROMPT_SESCIENTOS,
ES_PROMPT_SETECIENTOS,
ES_PROMPT_OCHOCIENTOS,
ES_PROMPT_NUEVECIENTOS,
ES_PROMPT_MIL = ES_PROMPT_NUMBERS_BASE+110,
ES_PROMPT_VIRGOLA = 111,
ES_PROMPT_UN,
ES_PROMPT_UNA,
ES_PROMPT_Y,
ES_PROMPT_MENO,
ES_PROMPT_HORA,
ES_PROMPT_HORAS,
ES_PROMPT_MINUTO,
ES_PROMPT_MINUTOS,
ES_PROMPT_SEGUNDO,
ES_PROMPT_SEGUNDOS,
ES_PROMPT_UNITS_BASE = 122,
ES_PROMPT_VOLTS = ES_PROMPT_UNITS_BASE+UNIT_VOLTS,
ES_PROMPT_AMPS = ES_PROMPT_UNITS_BASE+UNIT_AMPS,
ES_PROMPT_METERS_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND,
ES_PROMPT_SPARE1 = ES_PROMPT_UNITS_BASE+UNIT_RAW,
ES_PROMPT_KMH = ES_PROMPT_UNITS_BASE+UNIT_SPEED,
ES_PROMPT_METERS = ES_PROMPT_UNITS_BASE+UNIT_DIST,
ES_PROMPT_DEGREES = ES_PROMPT_UNITS_BASE+UNIT_TEMPERATURE,
ES_PROMPT_PERCENT = ES_PROMPT_UNITS_BASE+UNIT_PERCENT,
ES_PROMPT_MILLIAMPS = ES_PROMPT_UNITS_BASE+UNIT_MILLIAMPS,
ES_PROMPT_MAH = ES_PROMPT_UNITS_BASE+UNIT_MAH,
ES_PROMPT_WATTS = ES_PROMPT_UNITS_BASE+UNIT_WATTS,
ES_PROMPT_FEET = ES_PROMPT_UNITS_BASE+UNIT_FEET,
ES_PROMPT_KTS = ES_PROMPT_UNITS_BASE+UNIT_KTS,
ES_PROMPT_HOURS = ES_PROMPT_UNITS_BASE+UNIT_HOURS,
ES_PROMPT_MINUTES = ES_PROMPT_UNITS_BASE+UNIT_MINUTES,
ES_PROMPT_SECONDS = ES_PROMPT_UNITS_BASE+UNIT_SECONDS,
ES_PROMPT_RPMS = ES_PROMPT_UNITS_BASE+UNIT_RPMS,
ES_PROMPT_G = ES_PROMPT_UNITS_BASE+UNIT_G,
ES_PROMPT_MILLILITERS = ES_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
ES_PROMPT_FLOZ = ES_PROMPT_UNITS_BASE+UNIT_FLOZ,
ES_PROMPT_FEET_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
};
#define ES_PUSH_UNIT_PROMPT(u) es_pushUnitPrompt((u), id, fragmentVolume)
I18N_PLAY_FUNCTION(es, pushUnitPrompt, uint8_t unitprompt)
{
PUSH_UNIT_PROMPT(unitprompt, 0);
}
I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
/* if digit >= 1000000000:
temp_digit, digit = divmod(digit, 1000000000)
prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
if digit >= 1000000:
temp_digit, digit = divmod(digit, 1000000)
prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
*/
if (number < 0) {
PUSH_NUMBER_PROMPT(ES_PROMPT_MENO);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(ES_PROMPT_VIRGOLA);
if (mode==2 && qr.rem < 10)
PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO);
PLAY_NUMBER(qr.rem, unit, 0);
}
else {
PLAY_NUMBER(qr.quot, unit, 0);
}
return;
}
if (number >= 1000) {
if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(ES_PROMPT_MIL);
} else {
PUSH_NUMBER_PROMPT(ES_PROMPT_MIL);
}
number %= 1000;
if (number == 0)
number = -1;
}
if (number > 100) {
PUSH_NUMBER_PROMPT(ES_PROMPT_CIENTO + (number/100) - 1);
number %= 100;
if (number == 0)
number = -1;
}
if (number == 100) {
PUSH_NUMBER_PROMPT(ES_PROMPT_CIEN);
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO+number);
}
if (unit) {
ES_PUSH_UNIT_PROMPT(unit);
}
}
I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(ES_PROMPT_MENO);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
if (hours > 1) {
PLAY_NUMBER(hours, 0, 0);
PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
} else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
PUSH_UNIT_PROMPT(UNIT_HOURS, 0);
}
}
if (minutes > 0) {
if (minutes > 1) {
PLAY_NUMBER(minutes, 0, 0);
PUSH_UNIT_PROMPT(UNIT_MINUTES, 1);
} else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UN);
PUSH_UNIT_PROMPT(UNIT_MINUTES, 0);
}
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (seconds > 1) {
PLAY_NUMBER(seconds, 0, 0);
PUSH_UNIT_PROMPT(UNIT_SECONDS, 1);
} else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UN);
PUSH_UNIT_PROMPT(UNIT_SECONDS, 0);
}
}
}
LANGUAGE_PACK_DECLARE(es, STR_VOICE_ESPANOL);
+172
View File
@@ -0,0 +1,172 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum FrenchPrompts {
FR_PROMPT_NUMBERS_BASE = 0,
FR_PROMPT_ZERO = FR_PROMPT_NUMBERS_BASE+0,
FR_PROMPT_CENT = FR_PROMPT_NUMBERS_BASE+100,
FR_PROMPT_DEUX_CENT = FR_PROMPT_CENT+1,
FR_PROMPT_MILLE = FR_PROMPT_CENT+9,
FR_PROMPT_UNE = 110,
FR_PROMPT_ONZE,
FR_PROMPT_VINGT_ET_UNE,
FR_PROMPT_TRENTE_ET_UNE,
FR_PROMPT_QUARANTE_ET_UNE,
FR_PROMPT_CINQUANTE_ET_UNE,
FR_PROMPT_SOIXANTE_ET_UNE,
FR_PROMPT_SOIXANTE_ET_ONZE,
FR_PROMPT_QUATRE_VINGT_UNE,
FR_PROMPT_VIRGULE = 119,
FR_PROMPT_ET = 120,
FR_PROMPT_MOINS = 121,
FR_PROMPT_MINUIT = 122,
FR_PROMPT_MIDI = 123,
FR_PROMPT_UNITS_BASE = 124,
FR_PROMPT_HEURE = FR_PROMPT_UNITS_BASE+UNIT_HOURS,
FR_PROMPT_MINUTE = FR_PROMPT_UNITS_BASE+UNIT_MINUTES,
FR_PROMPT_SECONDE = FR_PROMPT_UNITS_BASE+UNIT_SECONDS,
FR_PROMPT_VIRGULE_BASE = 180, //,0 - ,9
};
#define FR_PUSH_UNIT_PROMPT(u) fr_pushUnitPrompt((u), id, fragmentVolume)
I18N_PLAY_FUNCTION(fr, pushUnitPrompt, uint8_t unitprompt)
{
PUSH_UNIT_PROMPT(unitprompt, 0);
}
#define FEMININ 0x80
I18N_PLAY_FUNCTION(fr, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
/* if digit >= 1000000000:
temp_digit, digit = divmod(digit, 1000000000)
prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
if digit >= 1000000:
temp_digit, digit = divmod(digit, 1000000)
prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
*/
if (number < 0) {
PUSH_NUMBER_PROMPT(FR_PROMPT_MOINS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(FR_PROMPT_VIRGULE_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
if (number >= 1000) {
if (number >= 2000)
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(FR_PROMPT_MILLE);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
if (number >= 200)
PUSH_NUMBER_PROMPT(FR_PROMPT_ZERO + number/100);
PUSH_NUMBER_PROMPT(FR_PROMPT_CENT);
number %= 100;
if (number == 0)
number = -1;
}
if (((number % 10) == 1) && number < 90 && (att & FEMININ)) {
PUSH_NUMBER_PROMPT(FR_PROMPT_UNE+(number/10));
}
else if (number >= 0) {
PUSH_NUMBER_PROMPT(FR_PROMPT_ZERO+number);
}
if (unit) {
FR_PUSH_UNIT_PROMPT(unit);
}
}
I18N_PLAY_FUNCTION(fr, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(0, 0, FEMININ);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(FR_PROMPT_MOINS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (IS_PLAY_TIME() && hours == 0) {
PUSH_NUMBER_PROMPT(FR_PROMPT_MINUIT);
} else if (IS_PLAY_TIME() && hours == 12) {
PUSH_NUMBER_PROMPT(FR_PROMPT_MIDI);
} else if (hours > 0) {
PLAY_NUMBER(hours, UNIT_HOURS, FEMININ);
}
if (minutes > 0) {
if (IS_PLAY_TIME()) {
PLAY_NUMBER(minutes, 0, minutes == 1 ? FEMININ : 0);
} else {
PLAY_NUMBER(minutes, UNIT_MINUTES, FEMININ);
}
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(FR_PROMPT_ET);
PLAY_NUMBER(seconds, UNIT_SECONDS, FEMININ);
}
}
LANGUAGE_PACK_DECLARE(fr, STR_VOICE_FRANCAIS);
+133
View File
@@ -0,0 +1,133 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum HebrewPrompts {
HE_PROMPT_NUMBERS_BASE = 0,
HE_PROMPT_ZERO = HE_PROMPT_NUMBERS_BASE+0, //02-99
HE_PROMPT_HUNDRED = HE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
HE_PROMPT_THOUSAND = HE_PROMPT_NUMBERS_BASE+109, //1000
HE_PROMPT_AND = HE_PROMPT_NUMBERS_BASE+110,
HE_PROMPT_MINUS = HE_PROMPT_NUMBERS_BASE+111,
HE_PROMPT_POINT = HE_PROMPT_NUMBERS_BASE+112,
HE_PROMPT_UNITS_BASE = 113,
HE_PROMPT_POINT_BASE = 167, //.0 - .9
};
#define HE_PUSH_UNIT_PROMPT(u, p) he_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(he, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(he, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(HE_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(HE_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(HE_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(HE_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(HE_PROMPT_ZERO + number);
}
if (unit) {
HE_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(he, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(HE_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(HE_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(he, STR_VOICE_HEBREW);
+131
View File
@@ -0,0 +1,131 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum HungarianPrompts {
HU_PROMPT_NUMBERS_BASE = 0,
HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99
HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000
HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110,
HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111,
HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112,
HU_PROMPT_UNITS_BASE = 113,
HU_PROMPT_POINT_BASE = 165, //.0 - .9
};
#define HU_PUSH_UNIT_PROMPT(u, p) hu_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(hu, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number);
}
if (unit) {
HU_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(hu, STR_VOICE_HUNGARIAN);
+183
View File
@@ -0,0 +1,183 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum ItalianPrompts {
IT_PROMPT_NUMBERS_BASE = 0,
IT_PROMPT_ZERO = IT_PROMPT_NUMBERS_BASE+0,
IT_PROMPT_CENT = IT_PROMPT_NUMBERS_BASE+100,
IT_PROMPT_MILA = IT_PROMPT_NUMBERS_BASE+101,
IT_PROMPT_MILLE = IT_PROMPT_NUMBERS_BASE+102,
IT_PROMPT_VIRGOLA = 103,
IT_PROMPT_UN,
IT_PROMPT_E,
IT_PROMPT_MENO,
IT_PROMPT_ORA,
IT_PROMPT_ORE,
IT_PROMPT_MINUTO,
IT_PROMPT_MINUTI,
IT_PROMPT_SECONDO,
IT_PROMPT_SECONDI,
IT_PROMPT_UNITS_BASE = 113,
IT_PROMPT_VOLTS = IT_PROMPT_UNITS_BASE+(UNIT_VOLTS*2),
IT_PROMPT_AMPS = IT_PROMPT_UNITS_BASE+(UNIT_AMPS*2),
IT_PROMPT_METERS_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_METERS_PER_SECOND*2),
IT_PROMPT_SPARE1 = IT_PROMPT_UNITS_BASE+(UNIT_RAW*2),
IT_PROMPT_KMH = IT_PROMPT_UNITS_BASE+(UNIT_SPEED*2),
IT_PROMPT_METERS = IT_PROMPT_UNITS_BASE+(UNIT_DIST*2),
IT_PROMPT_DEGREES = IT_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*2),
IT_PROMPT_PERCENT = IT_PROMPT_UNITS_BASE+(UNIT_PERCENT*2),
IT_PROMPT_MILLIAMPS = IT_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*2),
IT_PROMPT_MAH = IT_PROMPT_UNITS_BASE+(UNIT_MAH*2),
IT_PROMPT_WATTS = IT_PROMPT_UNITS_BASE+(UNIT_WATTS*2),
IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+(UNIT_FEET*2),
IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+(UNIT_KTS*2),
IT_PROMPT_MILLILITERS = IT_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*2),
IT_PROMPT_FLOZ = IT_PROMPT_UNITS_BASE+(UNIT_FLOZ*2),
IT_PROMPT_FEET_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*2),
};
#define IT_PUSH_UNIT_PROMPT(u, p) it_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(it, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
/* if digit >= 1000000000:
temp_digit, digit = divmod(digit, 1000000000)
prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
if digit >= 1000000:
temp_digit, digit = divmod(digit, 1000000)
prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
*/
getvalue_t orignumber;
if (number < 0) {
PUSH_NUMBER_PROMPT(IT_PROMPT_MENO);
number = -number;
}
orignumber=number;
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA);
if (mode==2 && qr.rem < 10)
PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO);
PLAY_NUMBER(qr.rem, 0, 0);
}
else {
if (qr.quot==1) {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
if (unit) {
PUSH_NUMBER_PROMPT(IT_PROMPT_UNITS_BASE+(unit*2));
}
return;
} else {
PLAY_NUMBER(qr.quot, 0, 0);
}
}
} else {
if (orignumber == 1 && unit) {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
} else {
if (number >= 1000) {
if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_MILA);
} else {
PUSH_NUMBER_PROMPT(IT_PROMPT_MILLE);
}
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
if (number >= 200)
PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO + number/100);
PUSH_NUMBER_PROMPT(IT_PROMPT_CENT);
number %= 100;
if (number == 0)
number = -1;
}
PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO+number);
}
}
if (unit) {
IT_PUSH_UNIT_PROMPT(unit, orignumber);
}
}
I18N_PLAY_FUNCTION(it, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(IT_PROMPT_MENO);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(IT_PROMPT_E);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(it, STR_VOICE_ITALIANO);
+133
View File
@@ -0,0 +1,133 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum JapanesePrompts {
JP_PROMPT_NUMBERS_BASE = 0,
JP_PROMPT_ZERO = JP_PROMPT_NUMBERS_BASE+0, //02-99
JP_PROMPT_HUNDRED = JP_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
JP_PROMPT_THOUSAND = JP_PROMPT_NUMBERS_BASE+109, //1000
JP_PROMPT_AND = JP_PROMPT_NUMBERS_BASE+110,
JP_PROMPT_MINUS = JP_PROMPT_NUMBERS_BASE+111,
JP_PROMPT_POINT = JP_PROMPT_NUMBERS_BASE+112,
JP_PROMPT_UNITS_BASE = 113,
JP_PROMPT_POINT_BASE = 167, //.0 - .9
};
#define JP_PUSH_UNIT_PROMPT(u, p) jp_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(jp, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(jp, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(JP_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(JP_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(JP_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(JP_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(JP_PROMPT_ZERO + number);
}
if (unit) {
JP_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(jp, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(JP_PROMPT_MINUS);
seconds = -seconds;
}
uint8_t tmp;
if (IS_PLAY_LONG_TIMER()) {
tmp = seconds / 60;
if (seconds % 60 >= 30) tmp += 1;
if (tmp > 0) PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
} else {
tmp = seconds / 3600;
seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, 0);
}
tmp = seconds / 60;
seconds %= 60;
if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
if (seconds > 0) PUSH_NUMBER_PROMPT(JP_PROMPT_AND);
}
if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
}
LANGUAGE_PACK_DECLARE(jp, STR_VOICE_JAPANESE);
+129
View File
@@ -0,0 +1,129 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum KoreanPrompts {
KO_PROMPT_NUMBERS_BASE = 0,
KO_PROMPT_ZERO = KO_PROMPT_NUMBERS_BASE + 0,
KO_PROMPT_HUNDRED = KO_PROMPT_NUMBERS_BASE + 100,
KO_PROMPT_THOUSAND = KO_PROMPT_NUMBERS_BASE + 109,
KO_PROMPT_AND = KO_PROMPT_NUMBERS_BASE + 110,
KO_PROMPT_MINUS = KO_PROMPT_NUMBERS_BASE + 111,
KO_PROMPT_POINT = KO_PROMPT_NUMBERS_BASE + 112,
KO_PROMPT_UNITS_BASE = 113,
KO_PROMPT_POINT_BASE = 167,
};
#define KO_PUSH_UNIT_PROMPT(u, p) \
ko_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(ko, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(ko, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(KO_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(KO_PROMPT_POINT_BASE + qr.rem);
number = -1;
} else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(KO_PROMPT_THOUSAND);
number %= 1000;
if (number == 0) number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(KO_PROMPT_HUNDRED + (number / 100) - 1);
number %= 100;
if (number == 0) number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(KO_PROMPT_ZERO + number);
}
if (unit) {
KO_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(ko, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(KO_PROMPT_MINUS);
seconds = -seconds;
}
uint8_t tmp;
if (IS_PLAY_LONG_TIMER()) {
tmp = seconds / 60;
if (seconds % 60 >= 30) tmp += 1;
if (tmp > 0) PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
} else {
tmp = seconds / 3600;
seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, 0);
}
tmp = seconds / 60;
seconds %= 60;
if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
if (seconds > 0) PUSH_NUMBER_PROMPT(KO_PROMPT_AND);
}
if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
}
LANGUAGE_PACK_DECLARE(ko, STR_VOICE_KOREAN);
+135
View File
@@ -0,0 +1,135 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
// NOTE: This file is identical to the EN version
#include "edgetx.h"
enum DutchPrompts {
NL_PROMPT_NUMBERS_BASE = 0,
NL_PROMPT_ZERO = NL_PROMPT_NUMBERS_BASE+0, //02-99
NL_PROMPT_HUNDRED = NL_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
NL_PROMPT_THOUSAND = NL_PROMPT_NUMBERS_BASE+109, //1000
NL_PROMPT_AND = NL_PROMPT_NUMBERS_BASE+110,
NL_PROMPT_MINUS = NL_PROMPT_NUMBERS_BASE+111,
NL_PROMPT_POINT = NL_PROMPT_NUMBERS_BASE+112,
NL_PROMPT_UNITS_BASE = 113,
NL_PROMPT_POINT_BASE = 167, //.0 - .9
};
#define NL_PUSH_UNIT_PROMPT(u, p) nl_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(nl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(nl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(NL_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(NL_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(NL_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(NL_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(NL_PROMPT_ZERO + number);
}
if (unit) {
NL_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(nl, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(NL_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(NL_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(nl, STR_VOICE_DUTCH);
+238
View File
@@ -0,0 +1,238 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum PolishPrompts {
PL_PROMPT_NUMBERS_BASE = 0,
PL_PROMPT_ZERO = PL_PROMPT_NUMBERS_BASE+0, //0-99
PL_PROMPT_STO = PL_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
PL_PROMPT_TYSIAC = PL_PROMPT_NUMBERS_BASE+109, //1000
PL_PROMPT_TYSIACE = PL_PROMPT_NUMBERS_BASE+110,
PL_PROMPT_TYSIECY = PL_PROMPT_NUMBERS_BASE+111,
PL_PROMPT_JEDNA = PL_PROMPT_NUMBERS_BASE+112,
PL_PROMPT_JEDNO = PL_PROMPT_NUMBERS_BASE+113,
PL_PROMPT_DWIE = PL_PROMPT_NUMBERS_BASE+114,
PL_PROMPT_CALA = PL_PROMPT_NUMBERS_BASE+115,
PL_PROMPT_CALE = PL_PROMPT_NUMBERS_BASE+116,
PL_PROMPT_CALYCH = PL_PROMPT_NUMBERS_BASE+117,
PL_PROMPT_MINUS = PL_PROMPT_NUMBERS_BASE+118,
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
PL_PROMPT_UNITS_BASE = 160,
PL_PROMPT_VOLTS = PL_PROMPT_UNITS_BASE+UNIT_VOLTS, //(jeden)wolt,(dwa)wolty,(piec+)woltów i tak dla wszytkich unitów
PL_PROMPT_AMPS = PL_PROMPT_UNITS_BASE+(UNIT_AMPS*4),
PL_PROMPT_METERS_PER_SECOND = PL_PROMPT_UNITS_BASE+(UNIT_METERS_PER_SECOND*4),
PL_PROMPT_SPARE1 = PL_PROMPT_UNITS_BASE+(UNIT_RAW*4),
PL_PROMPT_KMH = PL_PROMPT_UNITS_BASE+(UNIT_SPEED*4),
PL_PROMPT_METERS = PL_PROMPT_UNITS_BASE+(UNIT_DIST*4),
PL_PROMPT_DEGREES = PL_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*4),
PL_PROMPT_PERCENT = PL_PROMPT_UNITS_BASE+(UNIT_PERCENT*4),
PL_PROMPT_MILLIAMPS = PL_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*4),
PL_PROMPT_MAH = PL_PROMPT_UNITS_BASE+(UNIT_MAH*4),
PL_PROMPT_WATTS = PL_PROMPT_UNITS_BASE+(UNIT_WATTS*4),
PL_PROMPT_DB = PL_PROMPT_UNITS_BASE+(UNIT_DB*4),
PL_PROMPT_FEET = PL_PROMPT_UNITS_BASE+(UNIT_FEET*4),
PL_PROMPT_KTS = PL_PROMPT_UNITS_BASE+(UNIT_KTS*4),
PL_PROMPT_HOURS = PL_PROMPT_UNITS_BASE+(UNIT_HOURS*4),
PL_PROMPT_MINUTES = PL_PROMPT_UNITS_BASE+(UNIT_MINUTES*4),
PL_PROMPT_SECONDS = PL_PROMPT_UNITS_BASE+(UNIT_SECONDS*4),
PL_PROMPT_RPMS = PL_PROMPT_UNITS_BASE+(UNIT_RPMS*4),
PL_PROMPT_G = PL_PROMPT_UNITS_BASE+(UNIT_G*4),
PL_PROMPT_MILLILITERS = PL_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*4),
PL_PROMPT_FLOZ = PL_PROMPT_UNITS_BASE+(UNIT_FLOZ*4),
PL_PROMPT_FEET_PER_SECOND = PL_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*4),
};
#define PL_PUSH_UNIT_PROMPT(u, p) pl_pushUnitPrompt((u), (p), id, fragmentVolume)
#define MESKI 0x80
#define ZENSKI 0x81
#define NIJAKI 0x82
I18N_PLAY_FUNCTION(pl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else if (number > 1 && number < 5)
PUSH_UNIT_PROMPT(unitprompt, 1);
else {
int test_2 =0;
test_2 =number % 10;
int ten=0;
ten=(number - (number % 10))/10;
if ((test_2 > 1 && test_2 < 5) && ten >=2)
PUSH_UNIT_PROMPT(unitprompt, 1);
else
PUSH_UNIT_PROMPT(unitprompt, 2);
}
}
I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(PL_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, ZENSKI);
if (qr.quot == 0)
PUSH_NUMBER_PROMPT(PL_PROMPT_CALA);
else
PL_PUSH_UNIT_PROMPT(PL_PROMPT_CALA, qr.quot);
PLAY_NUMBER(qr.rem, 0, ZENSKI);
PUSH_NUMBER_PROMPT(PL_PROMPT_UNITS_BASE+((unit-1)*4)+3);
return;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
switch(unit) {
case 0:
break;
// ft/s
case 6:
// mph
case 8:
// feet
case 10:
//mAh
case 14:
//flOz
case 21:
//Hours
case 22:
//Minutes
case 23:
//Seconds
case 24:
att = ZENSKI;
break;
case 100:
att = NIJAKI;
break;
default:
att = MESKI;
break;
}
if ((number == 1) && (att == ZENSKI)) {
PUSH_NUMBER_PROMPT(PL_PROMPT_JEDNA);
number = -1;
}
if ((number == 1) && (att == NIJAKI)) {
PUSH_NUMBER_PROMPT(PL_PROMPT_JEDNO);
number = -1;
}
if ((number == 2) && (att == ZENSKI)) {
PUSH_NUMBER_PROMPT(PL_PROMPT_DWIE);
number = -1;
}
if (number >= 1000) {
if (number >= 2000)
PLAY_NUMBER(number / 1000, 0, 0);
if (number >= 2000 && number < 5000)
PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIACE);
else if (number >= 5000)
PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIECY);
else
PUSH_NUMBER_PROMPT(PL_PROMPT_TYSIAC);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(PL_PROMPT_STO + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
int test_2 =0;
test_2 =number % 10;
int ten=0;
ten=(number - (number % 10))/10;
if (att == ZENSKI && test_2==2 && ten >= 2 ) {
PUSH_NUMBER_PROMPT(PL_PROMPT_DZIESIATKI_ZENSKIE+ten);
}else
PUSH_NUMBER_PROMPT(PL_PROMPT_ZERO+number);
}
if (unit) {
PL_PUSH_UNIT_PROMPT(unit, tmp);
}
}
// The whole funtion has to be changed
I18N_PLAY_FUNCTION(pl, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(PL_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, ZENSKI);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, ZENSKI);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKI);
}
}
LANGUAGE_PACK_DECLARE(pl, STR_VOICE_POLISH);
+188
View File
@@ -0,0 +1,188 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum PortuguesePrompts {
PT_PROMPT_NUMBERS_BASE = 0,
PT_PROMPT_ZERO = PT_PROMPT_NUMBERS_BASE+0,
PT_PROMPT_CEM = PT_PROMPT_NUMBERS_BASE+100,
PT_PROMPT_CENTO = PT_PROMPT_NUMBERS_BASE+101,
PT_PROMPT_DUZENTOS = PT_PROMPT_NUMBERS_BASE+102,
PT_PROMPT_TREZCENTOS,
PT_PROMPT_QUATROCENTOS,
PT_PROMPT_QUINHENTOS,
PT_PROMPT_SEISCENTOS,
PT_PROMPT_SETECENTOS,
PT_PROMPT_OITOCENTOS,
PT_PROMPT_NUEVECENTOS,
PT_PROMPT_MIL = PT_PROMPT_NUMBERS_BASE+110,
PT_PROMPT_VIRGULA = 111,
PT_PROMPT_UMA,
PT_PROMPT_DUAS,
PT_PROMPT_E,
PT_PROMPT_MENOS,
PT_PROMPT_HORA,
PT_PROMPT_HORAS,
PT_PROMPT_MINUTO,
PT_PROMPT_MINUTOS,
PT_PROMPT_SEGUNDO,
PT_PROMPT_SEGUNDOS,
PT_PROMPT_UNITS_BASE = 122,
PT_PROMPT_VOLTS = PT_PROMPT_UNITS_BASE+UNIT_VOLTS,
PT_PROMPT_AMPS = PT_PROMPT_UNITS_BASE+UNIT_AMPS,
PT_PROMPT_METERS_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND,
PT_PROMPT_SPARE1 = PT_PROMPT_UNITS_BASE+UNIT_RAW,
PT_PROMPT_KMH = PT_PROMPT_UNITS_BASE+UNIT_SPEED,
PT_PROMPT_METERS = PT_PROMPT_UNITS_BASE+UNIT_DIST,
PT_PROMPT_DEGREES = PT_PROMPT_UNITS_BASE+UNIT_TEMPERATURE,
PT_PROMPT_PERCENT = PT_PROMPT_UNITS_BASE+UNIT_PERCENT,
PT_PROMPT_MILLIAMPS = PT_PROMPT_UNITS_BASE+UNIT_MILLIAMPS,
PT_PROMPT_MAH = PT_PROMPT_UNITS_BASE+UNIT_MAH,
PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS,
PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET,
PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS,
PT_PROMPT_MILLILITERS = PT_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
PT_PROMPT_FLOZ = PT_PROMPT_UNITS_BASE+UNIT_FLOZ,
PT_PROMPT_FEET_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
};
#define PT_PUSH_UNIT_PROMPT(u) pt_pushUnitPrompt((u), id, fragmentVolume)
I18N_PLAY_FUNCTION(pt, pushUnitPrompt, uint8_t unitprompt)
{
PUSH_UNIT_PROMPT(unitprompt, 0);
}
I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(PT_PROMPT_VIRGULA);
if (mode==2 && qr.rem < 10)
PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO);
PLAY_NUMBER(qr.rem, unit, 0);
}
else {
PLAY_NUMBER(qr.quot, unit, 0);
}
return;
}
if (number >= 1000) {
if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(PT_PROMPT_MIL);
} else {
PUSH_NUMBER_PROMPT(PT_PROMPT_MIL);
}
number %= 1000;
if (number == 0)
number = -1;
}
if (number > 100) {
PUSH_NUMBER_PROMPT(PT_PROMPT_CEM + number/100);
number %= 100;
if (number == 0)
number = -1;
}
if (number == 100) {
PUSH_NUMBER_PROMPT(PT_PROMPT_CEM);
}
else {
PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO + number);
}
if (unit) {
PT_PUSH_UNIT_PROMPT(unit);
}
}
I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
if (hours > 2) {
PLAY_NUMBER(hours, 0, 0);
PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
} else if (hours == 2) {
PUSH_NUMBER_PROMPT(PT_PROMPT_DUAS);
PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
} else if (hours == 1) {
PUSH_NUMBER_PROMPT(PT_PROMPT_UMA);
PUSH_UNIT_PROMPT(UNIT_HOURS, 0);
}
}
if (hours > 0 || minutes > 0) {
if (minutes > 1) {
PLAY_NUMBER(minutes, 0, 0);
PUSH_UNIT_PROMPT(UNIT_MINUTES, 1);
} else {
PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE + 1);
PUSH_UNIT_PROMPT(UNIT_MINUTES, 0);
}
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (hours || minutes)
PUSH_NUMBER_PROMPT(PT_PROMPT_E);
if (seconds > 1) {
PLAY_NUMBER(seconds, 0, 0);
PUSH_UNIT_PROMPT(UNIT_SECONDS, 1);
} else {
PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE + 1);
PUSH_UNIT_PROMPT(UNIT_SECONDS, 0);
}
}
}
LANGUAGE_PACK_DECLARE(pt, STR_VOICE_PORTUGUES);
+192
View File
@@ -0,0 +1,192 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum RusPrompts {
RU_PROMPT_NUMBERS_BASE = 0,
RU_PROMPT_ZERO = RU_PROMPT_NUMBERS_BASE+0, //02-99
RU_PROMPT_HUNDRED = RU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
RU_PROMPT_AND = RU_PROMPT_NUMBERS_BASE+110, // и
RU_PROMPT_MINUS = RU_PROMPT_NUMBERS_BASE+111, // минус
RU_PROMPT_UNITS_BASE = RU_PROMPT_NUMBERS_BASE + 113,
RU_PROMPT_POINT_BASE = RU_PROMPT_NUMBERS_BASE + 165, //.0 - .9
RU_PROMPT_FEMALE_ONE = RU_PROMPT_NUMBERS_BASE + 180,
RU_PROMPT_FEMALE_TWO = RU_PROMPT_NUMBERS_BASE + 190,
RU_PROMPT_THOUSAND1 = RU_PROMPT_NUMBERS_BASE+200, //1000
RU_PROMPT_THOUSAND2 = RU_PROMPT_NUMBERS_BASE+201, //2000
RU_PROMPT_THOUSAND5 = RU_PROMPT_NUMBERS_BASE+202, //5000
};
#define MALE 0x00
#define FEMALE 0x01
#define RU_FEMALE_UNIT 0xFF
#define RU_PUSH_UNIT_PROMPT(u, p) ru_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(ru, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number < 0){ // if negative number, we have to use 2 units form (for example value = 1.3)
PUSH_UNIT_PROMPT(unitprompt, 2);
}
else{
int16_t mod10 = number % 10;
if (number == 0)
PUSH_UNIT_PROMPT(unitprompt, 0);
else if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 1);
else if (number>=2 && number <=4)
PUSH_UNIT_PROMPT(unitprompt, 2);
else if (number>=5 && number <=20)
PUSH_UNIT_PROMPT(unitprompt, 5);
else if (mod10 == 1)
PUSH_UNIT_PROMPT(unitprompt, 1);
else if (mod10 >= 2 && mod10 <=4)
PUSH_UNIT_PROMPT(unitprompt, 2);
else
PUSH_UNIT_PROMPT(unitprompt, 5);
}
}
I18N_PLAY_FUNCTION(ru, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(RU_PROMPT_MINUS);
number = -number;
}
div_t qr = div((int)number, 10);
int8_t mode = MODE(att);
if (mode > 0 && att != RU_FEMALE_UNIT) {
if (mode == 2) {
number /= 10;
}
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(RU_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, RU_FEMALE_UNIT, 0); // female
uint8_t thousands = number / 1000;
int16_t mod10 = thousands % 10;
if (thousands == 1)
PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND1);
else if (thousands>=2 && thousands <=4)
PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND2);
else if (thousands>=5 && thousands <=20)
PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND5);
else if (mod10 == 1)
PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND1);
else if (mod10 >= 2 && mod10 <=4)
PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND2);
else
PUSH_NUMBER_PROMPT(RU_PROMPT_THOUSAND5);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(RU_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
uint8_t attr = MALE;
switch(unit) {
case RU_FEMALE_UNIT:
case UNIT_MPH:
case UNIT_FLOZ:
case UNIT_MINUTES:
case UNIT_SECONDS:
attr = FEMALE;
break;
default:
attr = MALE;
break;
}
uint8_t lastDigit = number % 10;
uint8_t ten=(number - (number % 10))/10;
if (lastDigit == 1 && number != 11 && attr == FEMALE)
PUSH_NUMBER_PROMPT(RU_PROMPT_FEMALE_ONE + ten);
else if (lastDigit == 2 && number !=12 && attr == FEMALE)
PUSH_NUMBER_PROMPT(RU_PROMPT_FEMALE_TWO + ten);
else
PUSH_NUMBER_PROMPT(RU_PROMPT_ZERO + number);
}
if (unit) {
if (mode > 0 && qr.rem) // number with decimal point
RU_PUSH_UNIT_PROMPT(unit, -1); // force 2 units form, if float value
else
RU_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(ru, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(RU_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(RU_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(ru, STR_VOICE_RUSSIAN);
+128
View File
@@ -0,0 +1,128 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum SwedishPrompts {
SE_PROMPT_NUMBERS_BASE = 0,
SE_PROMPT_ZERO = SE_PROMPT_NUMBERS_BASE+0, //02-99
SE_PROMPT_HUNDRED = SE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
SE_PROMPT_THOUSAND = SE_PROMPT_NUMBERS_BASE+109, //1000
SE_PROMPT_AND = SE_PROMPT_NUMBERS_BASE+110,
SE_PROMPT_MINUS = SE_PROMPT_NUMBERS_BASE+111,
SE_PROMPT_POINT = SE_PROMPT_NUMBERS_BASE+112,
SE_PROMPT_UNITS_BASE = 113,
SE_PROMPT_POINT_BASE = 165, //.0 - .9
};
#define SE_PUSH_UNIT_PROMPT(u, p) se_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(se, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else
PUSH_UNIT_PROMPT(unitprompt, 1);
}
I18N_PLAY_FUNCTION(se, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(SE_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmpNumber = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(SE_PROMPT_THOUSAND);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(SE_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(SE_PROMPT_ZERO + number);
}
if (unit) {
SE_PUSH_UNIT_PROMPT(unit, tmpNumber);
}
}
I18N_PLAY_FUNCTION(se, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(SE_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(se, STR_VOICE_SWEDISH);
+188
View File
@@ -0,0 +1,188 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum SlovakPrompts {
SK_PROMPT_NUMBERS_BASE = 0,
SK_PROMPT_NULA = SK_PROMPT_NUMBERS_BASE+0, //0-99
SK_PROMPT_STO = SK_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
SK_PROMPT_TISIC = SK_PROMPT_NUMBERS_BASE+109, //1000
SK_PROMPT_DVETISIC = SK_PROMPT_NUMBERS_BASE+110,
SK_PROMPT_JEDEN = SK_PROMPT_NUMBERS_BASE+111,
SK_PROMPT_JEDNO = SK_PROMPT_NUMBERS_BASE+112,
SK_PROMPT_DVE = SK_PROMPT_NUMBERS_BASE+113,
SK_PROMPT_CELA = SK_PROMPT_NUMBERS_BASE+114,
SK_PROMPT_CELE = SK_PROMPT_NUMBERS_BASE+115,
SK_PROMPT_CELYCH = SK_PROMPT_NUMBERS_BASE+116,
SK_PROMPT_MINUS = SK_PROMPT_NUMBERS_BASE+117,
SK_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu
};
#define SK_PUSH_UNIT_PROMPT(u, p) sk_pushUnitPrompt((u), (p), id, fragmentVolume)
#define MUZSKY 0x80
#define ZENSKY 0x81
#define STREDNI 0x82
I18N_PLAY_FUNCTION(sk, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0);
else if (number > 1 && number < 5)
PUSH_UNIT_PROMPT(unitprompt, 1);
else
PUSH_UNIT_PROMPT(unitprompt, 2);
}
I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
number = -number;
}
int8_t mode = MODE(att);
if (mode > 0) {
if (mode == 2) {
number /= 10;
}
div_t qr = div((int)number, 10);
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, ZENSKY);
if (qr.quot == 0)
PUSH_NUMBER_PROMPT(SK_PROMPT_CELA);
else
SK_PUSH_UNIT_PROMPT(SK_PROMPT_CELA, qr.quot);
PLAY_NUMBER(qr.rem, 0, ZENSKY);
PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3);
return;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
switch(unit) {
case 0:
break;
case 6:
case 8:
case 10:
case 14:
case 17:
case 21:
case 22:
case 23:
case 24:
att = ZENSKY;
break;
case 13:
case 18:
att = STREDNI;
break;
default:
att = MUZSKY;
break;
}
if ((number == 1) && (att == MUZSKY)) {
PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN);
number = -1;
}
if ((number == 1) && (att == STREDNI)) {
PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO);
number = -1;
}
if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) {
PUSH_NUMBER_PROMPT(SK_PROMPT_DVE);
number = -1;
}
if (number >= 1000) {
if (number >= 3000)
PLAY_NUMBER(number / 1000, 0, 0);
if (number >= 2000 && number < 3000)
PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC);
else
PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number);
}
if (unit) {
SK_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds < 0) {
PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, ZENSKY);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, ZENSKY);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY);
}
}
LANGUAGE_PACK_DECLARE(sk, STR_VOICE_SLOVAK);
+190
View File
@@ -0,0 +1,190 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "edgetx.h"
enum UAPrompts {
UA_PROMPT_NUMBERS_BASE = 0,
UA_PROMPT_ZERO = UA_PROMPT_NUMBERS_BASE+0, //02-99
UA_PROMPT_HUNDRED = UA_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
UA_PROMPT_AND = UA_PROMPT_NUMBERS_BASE+110, // и
UA_PROMPT_MINUS = UA_PROMPT_NUMBERS_BASE+111, // минус
UA_PROMPT_UNITS_BASE = UA_PROMPT_NUMBERS_BASE + 113,
UA_PROMPT_POINT_BASE = UA_PROMPT_NUMBERS_BASE + 165, //.0 - .9
UA_PROMPT_FEMALE_ONE = UA_PROMPT_NUMBERS_BASE + 180,
UA_PROMPT_FEMALE_TWO = UA_PROMPT_NUMBERS_BASE + 190,
UA_PROMPT_THOUSAND1 = UA_PROMPT_NUMBERS_BASE+200, //1000
UA_PROMPT_THOUSAND2 = UA_PROMPT_NUMBERS_BASE+201, //2000
UA_PROMPT_THOUSAND5 = UA_PROMPT_NUMBERS_BASE+202, //5000
};
#define MALE 0x00
#define FEMALE 0x01
#define UA_FEMALE_UNIT 0xFF
#define UA_PUSH_UNIT_PROMPT(u, p) ua_pushUnitPrompt((u), (p), id, fragmentVolume)
I18N_PLAY_FUNCTION(ua, pushUnitPrompt, uint8_t unitprompt, int16_t number)
{
if (number < 0){ // if negative number, we have to use 2 units form (for example value = 1.3)
PUSH_UNIT_PROMPT(unitprompt, 2);
}
else{
int16_t mod10 = number % 10;
if (number == 0)
PUSH_UNIT_PROMPT(unitprompt, 0);
else if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 1);
else if (number>=2 && number <=4)
PUSH_UNIT_PROMPT(unitprompt, 2);
else if (number>=5 && number <=20)
PUSH_UNIT_PROMPT(unitprompt, 5);
else if (mod10 == 1)
PUSH_UNIT_PROMPT(unitprompt, 1);
else if (mod10 >= 2 && mod10 <=4)
PUSH_UNIT_PROMPT(unitprompt, 2);
else
PUSH_UNIT_PROMPT(unitprompt, 5);
}
}
I18N_PLAY_FUNCTION(ua, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{
if (number < 0) {
PUSH_NUMBER_PROMPT(UA_PROMPT_MINUS);
number = -number;
}
div_t qr = div((int)number, 10);
int8_t mode = MODE(att);
if (mode > 0 && att != UA_FEMALE_UNIT) {
if (mode == 2) {
number /= 10;
}
if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(UA_PROMPT_POINT_BASE + qr.rem);
number = -1;
}
else {
number = qr.quot;
}
}
int16_t tmp = number;
if (number >= 1000) {
PLAY_NUMBER(number / 1000, UA_FEMALE_UNIT, 0); // female
uint8_t thousands = number / 1000;
int16_t mod10 = thousands % 10;
if (thousands == 1)
PUSH_NUMBER_PROMPT(UA_PROMPT_THOUSAND1);
else if (thousands>=2 && thousands <=4)
PUSH_NUMBER_PROMPT(UA_PROMPT_THOUSAND2);
else if (thousands>=5 && thousands <=20)
PUSH_NUMBER_PROMPT(UA_PROMPT_THOUSAND5);
else if (mod10 == 1)
PUSH_NUMBER_PROMPT(UA_PROMPT_THOUSAND1);
else if (mod10 >= 2 && mod10 <=4)
PUSH_NUMBER_PROMPT(UA_PROMPT_THOUSAND2);
else
PUSH_NUMBER_PROMPT(UA_PROMPT_THOUSAND5);
number %= 1000;
if (number == 0)
number = -1;
}
if (number >= 100) {
PUSH_NUMBER_PROMPT(UA_PROMPT_HUNDRED + (number/100)-1);
number %= 100;
if (number == 0)
number = -1;
}
if (number >= 0) {
uint8_t attr = MALE;
switch(unit) {
case UA_FEMALE_UNIT:
case UNIT_MPH:
case UNIT_FLOZ:
case UNIT_MINUTES:
case UNIT_SECONDS:
attr = FEMALE;
break;
default:
attr = MALE;
break;
}
uint8_t lastDigit = number % 10;
uint8_t ten=(number - (number % 10))/10;
if (lastDigit == 1 && number != 11 && attr == FEMALE)
PUSH_NUMBER_PROMPT(UA_PROMPT_FEMALE_ONE + ten);
else if (lastDigit == 2 && number !=12 && attr == FEMALE)
PUSH_NUMBER_PROMPT(UA_PROMPT_FEMALE_TWO + ten);
else
PUSH_NUMBER_PROMPT(UA_PROMPT_ZERO + number);
}
if (unit) {
if (mode > 0 && qr.rem) // number with decimal point
UA_PUSH_UNIT_PROMPT(unit, -1); // force 2 units form, if float value
else
UA_PUSH_UNIT_PROMPT(unit, tmp);
}
}
I18N_PLAY_FUNCTION(ua, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(UA_PROMPT_MINUS);
seconds = -seconds;
}
int hours, minutes;
hours = seconds / 3600;
seconds = seconds % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
if (IS_PLAY_LONG_TIMER() && seconds >= 30) {
minutes += 1;
}
if (hours > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(hours, UNIT_HOURS, 0);
}
if (minutes > 0) {
PLAY_NUMBER(minutes, UNIT_MINUTES, 0);
}
if (!IS_PLAY_LONG_TIMER() && seconds > 0) {
if (minutes)
PUSH_NUMBER_PROMPT(UA_PROMPT_AND);
PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
}
}
LANGUAGE_PACK_DECLARE(ua, STR_VOICE_UKRAINIAN);