From 4db530617853e2ef6d544c04f9ff698bd629d4c8 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:50:21 +0900 Subject: [PATCH] [Update] Config Page: Translation, Transcription Tab: CTranslate2, Whisper. Apply Localization. --- .../setting_box/transcription/Transcription.jsx | 15 ++++++++++++++- .../setting_box/translation/Translation.jsx | 10 +++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx b/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx index b8c0e604..162e20b9 100644 --- a/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import styles from "./Transcription.module.scss"; +import { updateLabelsById } from "@utils"; import { useMicRecordTimeout, @@ -250,6 +251,18 @@ const WhisperWeightType_Box = () => { downloadWhisperWeight(id); }; + const new_labels = [ + { id: "tiny", label: t("config_page.whisper_weight_type.model_template", {model_name: "tiny", capacity: "74.5MB"}) }, + { id: "base", label: t("config_page.whisper_weight_type.recommended_model_template", {model_name: "base", capacity: "141MB"}) }, + { id: "small", label: t("config_page.whisper_weight_type.model_template", {model_name: "small", capacity: "463MB"}) }, + { id: "medium", label: t("config_page.whisper_weight_type.model_template", {model_name: "medium", capacity: "1.42GB"}) }, + { id: "large-v1", label: t("config_page.whisper_weight_type.model_template", {model_name: "large-v1", capacity: "2.87GB"}) }, + { id: "large-v2", label: t("config_page.whisper_weight_type.model_template", {model_name: "large-v2", capacity: "2.87GB"}) }, + { id: "large-v3", label: t("config_page.whisper_weight_type.model_template", {model_name: "large-v3", capacity: "2.87GB"}) }, + ]; + + const whisper_weight_types = updateLabelsById(currentWhisperWeightTypeStatus.data, new_labels); + return ( <> { {translator: t("main_page.translator")} )} name="whisper_weight_type" - options={currentWhisperWeightTypeStatus.data} + options={whisper_weight_types} checked_variable={currentSelectedWhisperWeightType} selectFunction={selectFunction} downloadStartFunction={downloadStartFunction} diff --git a/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx b/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx index f9ec52be..cd714270 100644 --- a/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import styles from "./Translation.module.scss"; +import { updateLabelsById } from "@utils"; import { useDeepLAuthKey, @@ -40,6 +41,13 @@ const CTranslate2WeightType_Box = () => { downloadCTranslate2Weight(id); }; + const new_labels = [ + { id: "small", label: t("config_page.ctranslate2_weight_type.small", {capacity: "418MB"}) }, + { id: "large", label: t("config_page.ctranslate2_weight_type.large", {capacity: "1.2GB"}) }, + ]; + + const c_translate2_weight_types = updateLabelsById(currentCTranslate2WeightTypeStatus.data, new_labels); + return ( <> { {translator: t("main_page.translator")} )} name="ctransalte2_weight_type" - options={currentCTranslate2WeightTypeStatus.data} + options={c_translate2_weight_types} checked_variable={currentSelectedCTranslate2WeightType} selectFunction={selectFunction} downloadStartFunction={downloadStartFunction}