feat: Add support for Japanese voice language 🇯🇵 (#3261)

* Created tts_jp.cpp and added "TR_VOICE_JAPANESE" to the *.h file.

* Commented out once because the build did not work

* fix: Define `JP` as a TTS language,
- Fixes the undefined reference to `jpLanguagePack` error
- put things in alphabetical order as the comment suggests it should be

* chore: Add `JP` to Companion voice language list

---------

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
まっく まるちぷろとこる
2023-03-16 21:33:58 +10:00
committed by GitHub
co-authored by Peter Feerick
parent ddf5fdd906
commit 816a823727
19 changed files with 156 additions and 8 deletions
+2 -2
View File
@@ -348,12 +348,12 @@ void GeneralSetupPanel::populateVoiceLangCB()
QComboBox * b = ui->voiceLang_CB;
QString strings[] = { tr("English"), tr("Danish"), tr("Dutch"), tr("French"), tr("Italian"), tr("German"),
tr("Czech"), tr("Slovak"), tr("Spanish"), tr("Polish"), tr("Portuguese"), tr("Russian"),
tr("Swedish"), tr("Hungarian"), tr("Chinese"), NULL};
tr("Swedish"), tr("Hungarian"), tr("Chinese"), tr("Japanese"), NULL};
// Note: these align with the radio NOT computer locales - TODO harmonise with ISO and one list!!!
QString langcode[] = { "en", "da", "nl","fr", "it", "de",
"cz", "sk", "es", "pl", "pt", "ru",
"se", "hu", "cn", NULL};
"se", "hu", "cn", "jp", NULL};
b->clear();
for (int i=0; strings[i]!=NULL; i++) {
+2 -2
View File
@@ -2,8 +2,8 @@ include(CMakeForceCompiler)
include(Bitmaps)
set(PCB_TYPES X9LITE X9LITES X7 XLITE XLITES X9D X9D+ X9E X10 X12S NV14)
set(RADIO_LANGUAGES CZ DA DE EN ES FI FR IT PT SK SE PL HU NL CN TW JP)
set(TTS_LANGUAGES CZ DA DE EN ES FR IT PT SK SE PL HU NL RU CN)
set(RADIO_LANGUAGES CN CZ DA DE EN ES FI FR IT JP PT SK SE PL HU NL TW)
set(TTS_LANGUAGES CN CZ DA DE EN ES FR IT JP PT SK SE PL HU NL RU)
set(PCB "X9D+" CACHE STRING "Radio type, one of: ${PCB_TYPES}")
set_property(CACHE PCB PROPERTY STRINGS ${PCB_TYPES})
+3 -1
View File
@@ -838,11 +838,13 @@ extern const LanguagePack ruLanguagePack;
extern const LanguagePack seLanguagePack;
extern const LanguagePack skLanguagePack;
extern const LanguagePack cnLanguagePack;
extern const LanguagePack jpLanguagePack;
extern const LanguagePack * const languagePacks[];
#if defined(LANGUAGE_PACKS_DEFINITION)
const LanguagePack * const languagePacks[] = {
// alphabetical order
&cnLanguagePack,
&czLanguagePack,
&daLanguagePack,
&deLanguagePack,
@@ -851,13 +853,13 @@ const LanguagePack * const languagePacks[] = {
&frLanguagePack,
&huLanguagePack,
&itLanguagePack,
&jpLanguagePack,
&nlLanguagePack,
&plLanguagePack,
&ptLanguagePack,
&ruLanguagePack,
&seLanguagePack,
&skLanguagePack,
&cnLanguagePack,
NULL
};
#endif
+1
View File
@@ -1236,3 +1236,4 @@
#define TR_VOICE_SLOVAK "斯洛伐克语"
#define TR_VOICE_SWEDISH "瑞典语"
#define TR_VOICE_TAIWANESE "中文-台湾国语"
#define TR_VOICE_JAPANESE "日文"
+1
View File
@@ -1238,3 +1238,4 @@
#define TR_VOICE_SLOVAK "Slovenština"
#define TR_VOICE_SWEDISH "Švédština"
#define TR_VOICE_TAIWANESE "Tchajwanština"
#define TR_VOICE_JAPANESE "Japonština"
+1
View File
@@ -1251,3 +1251,4 @@
#define TR_VOICE_SLOVAK "Slovakisk"
#define TR_VOICE_SWEDISH "Svensk"
#define TR_VOICE_TAIWANESE "Taiwanesisk"
#define TR_VOICE_JAPANESE "Japansk"
+1
View File
@@ -1237,3 +1237,4 @@
#define TR_VOICE_SLOVAK "Slowenisch"
#define TR_VOICE_SWEDISH "Schwedisch"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanisch"
+1
View File
@@ -1230,3 +1230,4 @@
#define TR_VOICE_SLOVAK "Slovak"
#define TR_VOICE_SWEDISH "Swedish"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanese"
+1
View File
@@ -1241,3 +1241,4 @@
#define TR_VOICE_SLOVAK "Slovak"
#define TR_VOICE_SWEDISH "Swedish"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanese"
+1
View File
@@ -1254,3 +1254,4 @@
#define TR_VOICE_SLOVAK "Slovak"
#define TR_VOICE_SWEDISH "Swedish"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanese"
+1
View File
@@ -1259,3 +1259,4 @@
#define TR_VOICE_SLOVAK "Slovak"
#define TR_VOICE_SWEDISH "Swedish"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanese"
+1
View File
@@ -1246,3 +1246,4 @@
#define TR_VOICE_SLOVAK "Slovacco"
#define TR_VOICE_SWEDISH "Svedese"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Giapponese"
+2 -3
View File
@@ -31,8 +31,7 @@
#define TR_MIN_PLURAL2 2
#define TR_MAX_PLURAL2 2
// For this number of minute in the last decimal place singular form is used in
// plural
// For this number of minute in the last decimal place singular form is used in plural
#define TR_USE_SINGULAR_IN_PLURAL 1
#define TR_USE_PLURAL2_SPECIAL_CASE 0
// If the number of minutes is above this value PLURAL2 is used
@@ -925,7 +924,6 @@
#define TR_UNIT "ユニット"
#define TR_TELEMETRY_NEWSENSOR INDENT "新規追加"
#define TR_CHANNELRANGE TR(INDENT "Ch. Range", INDENT "チャンネル範囲")
#define TR_RXFREQUENCY TR("Rx Freqency", "受信サーボ周波数")
#define TR_ANTENNACONFIRM1 "外部アンテナ"
#if defined(PCBX12S)
#define TR_ANTENNA_MODES "内部","確認","モデル毎","内部+外部"
@@ -1233,3 +1231,4 @@
#define TR_VOICE_SLOVAK "スロバキア-SK"
#define TR_VOICE_SWEDISH "スウェーデン-SV"
#define TR_VOICE_TAIWANESE "中文-TW"
#define TR_VOICE_JAPANESE "日本-JP"
+1
View File
@@ -1251,3 +1251,4 @@
#define TR_VOICE_SLOVAK "Slovak"
#define TR_VOICE_SWEDISH "Swedish"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanese"
+1
View File
@@ -1235,3 +1235,4 @@
#define TR_VOICE_SLOVAK "Słowacki"
#define TR_VOICE_SWEDISH "Szwedzki"
#define TR_VOICE_TAIWANESE "Tajwański"
#define TR_VOICE_JAPANESE "Japonês"
+1
View File
@@ -1244,3 +1244,4 @@
#define TR_VOICE_SLOVAK "Slovak"
#define TR_VOICE_SWEDISH "Swedish"
#define TR_VOICE_TAIWANESE "Taiwanese"
#define TR_VOICE_JAPANESE "Japanese"
+1
View File
@@ -1277,3 +1277,4 @@
#define TR_VOICE_SLOVAK "Slovakiska"
#define TR_VOICE_SWEDISH "Svenska"
#define TR_VOICE_TAIWANESE "Taiwanesiska"
#define TR_VOICE_JAPANESE "Japanska"
+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 "opentx.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)
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, TR_VOICE_JAPANESE);
+1
View File
@@ -1234,3 +1234,4 @@
#define TR_VOICE_SLOVAK "斯洛伐克語"
#define TR_VOICE_SWEDISH "瑞典語"
#define TR_VOICE_TAIWANESE "中文-台灣國語"
#define TR_VOICE_JAPANESE "日文"