new language selector (WIP)
This commit is contained in:
parent
2f41de4fdd
commit
932a21647d
7 changed files with 109 additions and 9 deletions
|
|
@ -96,7 +96,6 @@ class STT:
|
|||
vosk_model = os.path.join(
|
||||
resources_folder, "speech_to_text_models", settings["STT"]["LANGUAGE"]
|
||||
)
|
||||
print(vosk_model)
|
||||
|
||||
self.model = Model(rf"{vosk_model}")
|
||||
self.dump_fn = None
|
||||
|
|
@ -137,7 +136,6 @@ class STT:
|
|||
self.is_running = False
|
||||
|
||||
settings.read(settingsPath)
|
||||
print(settingsPath)
|
||||
if settings["STT"]["USE_STT"] and bool(settings["STT"]["LANGUAGE"]):
|
||||
speech_recognition_service = STT()
|
||||
|
||||
|
|
|
|||
|
|
@ -517,8 +517,6 @@ h1 {
|
|||
.fi {
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
top: 45px;
|
||||
left: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
|
|
@ -540,5 +538,12 @@ h1 {
|
|||
position: relative;
|
||||
padding: 0px 0px 0px 0px;
|
||||
margin: -45px 0px 0px -40px;
|
||||
top: -15px;
|
||||
top: 30px;
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
.language-icon {
|
||||
position: relative;
|
||||
top: 45px;
|
||||
left: 20px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,3 +228,61 @@
|
|||
background-color: var(--main-color4-temp);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-color: blue;
|
||||
color: red;
|
||||
padding: 16px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pop {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.pop.up {
|
||||
}
|
||||
|
||||
.pop-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: black;
|
||||
z-index: 1;
|
||||
height: 400px;
|
||||
width: max-content;
|
||||
overflow: auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
top: -400px;
|
||||
color: white;
|
||||
}
|
||||
pop-content div {
|
||||
color: white;
|
||||
padding: 12px 16px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
.pop-content div:hover {
|
||||
display: none;
|
||||
/* background-color: black; */
|
||||
}
|
||||
.pop:hover .pop-content {
|
||||
display: grid;
|
||||
/* display: none; */
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
/* display: block; */
|
||||
}
|
||||
.pop:hover .btn {
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
.language-select {
|
||||
margin: 5px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.language-select:hover {
|
||||
background-color: blue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,12 +282,12 @@
|
|||
<div class="AdvancedMenuRow languageDetectionInput TRANSLATE_TO">
|
||||
<div class="AdvancedMenuLabel">Broadcast translation to chat</div>
|
||||
<input type="checkbox" id="BROADCAST_TRANSLATION" class="checkbox TRANSLATE_TO" />
|
||||
<label for="BROADCAST_TRANSLATION" class="toggle-small"></label>
|
||||
<label for="BROADCAST_TRANSLATION" class="toggle-small" style="margin-right: 260px"></label>
|
||||
</div>
|
||||
<div class="AdvancedMenuRow languageDetectionInput TRANSLATE_TO">
|
||||
<div class="AdvancedMenuLabel">Output translation to TTS</div>
|
||||
<input type="checkbox" id="OUTPUT_TO_TTS" class="checkbox TRANSLATE_TO" />
|
||||
<label for="OUTPUT_TO_TTS" class="toggle-small"></label>
|
||||
<label for="OUTPUT_TO_TTS" class="toggle-small" style="margin-right: 260px"></label>
|
||||
<i
|
||||
class="fa fa-question-circle fa-2x SmallButton option-icon-container"
|
||||
id="Info_OUTPUT_TO_TTS"
|
||||
|
|
@ -583,6 +583,12 @@
|
|||
<button class="SmallButton">
|
||||
<i class="fa-regular fa-grin fa-2x" id="emojis" aria-hidden="true"></i>
|
||||
</button>
|
||||
<div class="pop">
|
||||
<button class="SmallButton">
|
||||
<i class="fa-solid fa-globe fa-2x" aria-hidden="true"></i>
|
||||
</button>
|
||||
<div class="pop-content"></div>
|
||||
</div>
|
||||
<!-- User text input-->
|
||||
<input id="textInput" class="input-box" type="text" name="msg" placeholder="Tap 'Enter' to send a message" />
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ const languages = {
|
|||
kisii: { IETF: 'guz-KE', ISO639: 'guz', ISO3166: 'ke' },
|
||||
kongo: { IETF: 'kg-CG', ISO639: 'kg', ISO3166: 'cg' },
|
||||
konkani: { IETF: 'kok-IN', ISO639: 'kok', ISO3166: 'in' },
|
||||
korean: { IETF: 'ko-KR', ISO639: 'ko', ISO3166: 'ko' },
|
||||
korean: { IETF: 'ko-KR', ISO639: 'ko', ISO3166: 'kr' },
|
||||
'northern kurdish': { IETF: 'kmr-TR', ISO639: 'kmr', ISO3166: 'tr' },
|
||||
'kurdish sorani': { IETF: 'ckb-IQ', ISO639: 'ckb', ISO3166: 'iq' },
|
||||
kyrgyz: { IETF: 'ky-KG', ISO639: 'ky', ISO3166: 'kg' },
|
||||
|
|
|
|||
|
|
@ -163,6 +163,39 @@ async function getAudioDevices() {
|
|||
|
||||
getAudioDevices();
|
||||
|
||||
function setLanguagesinSelectx() {
|
||||
const languageSelect = document.querySelector('.pop-content'); // obtain the html reference of the google voices comboBox
|
||||
|
||||
for (const language in languageObject.languages) {
|
||||
if (Object.prototype.hasOwnProperty.call(languageObject.languages, language)) {
|
||||
const IETF = languageObject.languages[language].IETF;
|
||||
const ISO639 = languageObject.languages[language].ISO639;
|
||||
const ISO3166 = languageObject.languages[language].ISO3166;
|
||||
|
||||
const option = document.createElement('div');
|
||||
option.classList = 'language-select';
|
||||
|
||||
const languageElement = document.createElement('span');
|
||||
languageElement.classList = `fi fi-${ISO3166} fis`;
|
||||
option.setAttribute('tip', language);
|
||||
|
||||
const text = document.createElement('span');
|
||||
text.innerHTML = ` - ${ISO639}`;
|
||||
|
||||
option.value = IETF;
|
||||
|
||||
languageSelect.appendChild(option);
|
||||
option.appendChild(languageElement);
|
||||
option.appendChild(text);
|
||||
addSingleTooltip(option);
|
||||
}
|
||||
}
|
||||
|
||||
// languageSelect.selectedIndex = setting;
|
||||
}
|
||||
|
||||
setLanguagesinSelectx();
|
||||
|
||||
function setLanguagesinSelect(languageSelector, setting) {
|
||||
const languageSelect = document.querySelector(languageSelector); // obtain the html reference of the google voices comboBox
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ async function displayTwitchMessage(logoUrl, username, messageObject, filteredMe
|
|||
if (settings.LANGUAGE.USE_DETECTION) {
|
||||
await backend.getDetectedLanguage({ message: filteredMessage, messageId, username, logoUrl, formattedMessage }).then(language => {
|
||||
const languageElement = document.createElement('span');
|
||||
languageElement.classList = `fi fi-${language.ISO3166} fis`;
|
||||
languageElement.classList = `fi fi-${language.ISO3166} fis language-icon`;
|
||||
languageElement.setAttribute('tip', language.name);
|
||||
article.appendChild(languageElement);
|
||||
addSingleTooltip(languageElement);
|
||||
|
|
|
|||
Loading…
Reference in a new issue