Merge branch 'localization' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-09-26 12:43:12 +09:00
9 changed files with 346 additions and 102 deletions

109
locales/en.yml Normal file
View File

@@ -0,0 +1,109 @@
main_window:
translation: Translation
transcription_send: Voice2Chatbox
transcription_receive: Speaker2Log
foreground: Foreground
language_settings: Language Settings
your_language: Your Language
both_direction_desc: Translate Each Other
target_language: Target Language
textbox_tab_all: All
textbox_tab_sent: Sent
textbox_tab_received: Received
textbox_tab_system: System
update_available: New version is here!
selectable_language_window:
title_your_language: Select Your Language
title_target_language: Select Target Language
go_back_button: Go Back
config_window:
config_title: Settings
side_menu_labels:
appearance: Appearance
translation: Translation
transcription: Transcription
transcription_mic: Mic
transcription_speaker: Speaker
others: Others
advanced_settings: Advanced Settings
transparency:
label: Transparency
desc: Change the main window's transparency.
appearance_theme:
label: Theme
desc: Change the color theme. If you selected "System", it will adjust based on your Windows theme.
ui_size:
label: UI Size
font_family:
label: Font Family
ui_language:
label: UI Language
deepl_auth_key:
label: DeepL Auth Key
mic_host:
label: Mic Host/Driver
mic_device:
label: Mic Device
mic_energy_threshold:
label: Mic Energy Threshold
desc: Slider to modify the threshold for activating voice input. Press the microphone button to initiate input and speak, allowing you to adjust it while monitoring the actual volume.
mic_dynamic_energy_threshold:
label: Mic Dynamic Energy Threshold
desc: When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold.
mic_record_timeout:
label: Mic Record Timeout
mic_phrase_timeout:
label: Mic Phrase Timeout
mic_max_phrase:
label: Mic Max Phrases
desc: It will stop recording and send the recordings when the set count of phrase(s) is reached.
mic_word_filter:
label: Mic Word Filter
desc: "It will not send the sentence if the word(s) included in the set list of words.\nHow to set: e.g. AAA,BBB,CCC"
speaker_device:
label: Speaker Device
speaker_energy_threshold:
label: Speaker Energy Threshold
desc: Slider to modify the threshold for activating voice input. Press the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume.
speaker_dynamic_energy_threshold:
label: Speaker Dynamic Energy Threshold
desc: When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold.
speaker_record_timeout:
label: Speaker Record Timeout
speaker_phrase_timeout:
label: Speaker Phrase Timeout
speaker_max_phrase:
label: Speaker Max Phrases
desc: It will stop recording and receive the recordings when the set count of phrase(s) is reached.
auto_clear_the_message_box:
label: Auto Clear The Message Box
notice_xsoverlay:
label: Notification XSOverlay (VR Only)
desc: Notify received messages by using XSOverlay's notification feature.
auto_export_message_logs:
label: Auto Export Message Logs
desc: Automatically export the conversation messages as a text file.
message_format:
label: Message Format
desc: You can change the decoration of the message you want to send.
send_message_to_vrc:
label: Send Message To VRChat
desc: There is a way to use it without sending messages to VRChat. That is not covered by support, though.
startup_osc_enabled_check:
label: Check If OSC Is Enabled At Startup
desc: Every time VRCT is started up, your character in VRChat moves forward ever so slightly. If your character is seated, they might even stand up. Unfortunately, this is the only method we've found to check if OSC is enabled at startup... Sorry about that. (Remember to turn on OSC yourself when you want to send messages to VRChat.)
osc_ip_address:
label: OSC IP Address
osc_port:
label: OSC Port

110
locales/ja.yml Normal file
View File

@@ -0,0 +1,110 @@
main_window:
translation: 翻訳
transcription_send: マイク->チャットボックス
transcription_receive: スピーカー->ログ
foreground: 最前面表示
language_settings: 言語設定
your_language: あなたの言語
both_direction_desc: 双方向に翻訳
target_language: 相手の言語
textbox_tab_all: 全て
textbox_tab_sent: 送信
textbox_tab_received: 受信
textbox_tab_system: システム
update_available: 新しいバージョンが出ました!
selectable_language_window:
title_your_language: あなたの言語
title_target_language: 相手の言語
go_back_button: 戻る
config_window:
config_title: 設定
side_menu_labels:
appearance: デザイン
translation: 翻訳
transcription: 音声認識
transcription_mic: マイク
transcription_speaker: スピーカー
others: その他
advanced_settings: 高度な設定
transparency:
label: 透明度
desc: メイン画面の透明度を変更できます。
appearance_theme:
label: 外観テーマ
desc: カラーテーマを変更できます。「System」を選択した場合、Windowsのテーマに基づいて自動的に「Dark」か「Light」テーマを判断し、適用します。
ui_size:
label: UIのサイズ
font_family:
label: 使用フォント
ui_language:
label: UIの言語
tab_translation: 翻訳
deepl_auth_key:
label: DeepL 認証キー
mic_host:
label: マイク(ホスト/ドライバー)
mic_device:
label: マイク (デバイス)
mic_energy_threshold:
label: 音声取得のしきい値
desc: スライダーを調整してしきい値を決められます。マイクのアイコンを押すと、実際に声を入力し、音量を確認しながら調節できます。
mic_dynamic_energy_threshold:
label: 音声取得のしきい値の自動調整
desc: 有効にすると、設定されたしきい値に応じて、ある程度自動的に調節されます。
mic_record_timeout:
label: マイク音声の区切りの無音時間
mic_phrase_timeout:
label: 文字起こしする音声時間の上限
mic_max_phrase:
label: 保留する単語の上限(マイク)
desc: It will stop recording and send the recordings when the set count of phrase(s) is reached.
mic_word_filter:
label: ワードフィルタ
desc: "設定された単語を検出すると、その文章は送信されません。\n設定の例: AAA,BBB,CCC"
speaker_device:
label: スピーカー(デバイス)
speaker_energy_threshold:
label: 音声取得のしきい値
desc: スライダーを調整してしきい値を決められます。スピーカーのアイコンを押すと、設定されたデバイスから音を聞き取り、音量を確認しながら調節できます。
speaker_dynamic_energy_threshold:
label: 音声取得のしきい値の自動調整
desc: 有効にすると、設定されたしきい値に応じて、ある程度自動的に調節されます。
speaker_record_timeout:
label: スピーカー音声の区切りの無音時間
speaker_phrase_timeout:
label: 文字起こしする音声時間の上限
speaker_max_phrase:
label: 保留する単語の上限
desc: It will stop recording and receive the recordings when the set count of phrase(s) is reached.
auto_clear_the_message_box:
label: 送信後はチャットボックスを空にする
notice_xsoverlay:
label: XSOverlayの通知機能を有効 (VR限定)
desc: 文字起こし受信されたメッセージをXSOverlayの機能を使って通知として受け取れます。
auto_export_message_logs:
label: 会話ログを自動的に保存する
desc: テキストファイルとしてログが保存されます。保存先は/logs/...(調整中)
message_format:
label: 送信するメッセージのフォーマット
desc: VRChatで相手に実際に見えるフォーマットを変更できます。
send_message_to_vrc:
label: VRChatにメッセージを送信する
desc: VRChatにメッセージを送信せずに使う方法があります。サポート対象外ですが。
startup_osc_enabled_check:
label: 起動時にOSCが有効になっているか確認する
desc: 起動時に毎回、キャラクターがほんの少し前進します。もしsit判定などある場所に座っている場合、立ってしまうかもしれません。残念ながら今のところ私達はOSCがVRChat側で有効になっているか確認する方法がこれしか見つけられていません。ごめんね。(このチェック機能をオフにする場合、自分でOSCをオンにすることを忘れないでね。)
osc_ip_address:
label: OSC IP Address
osc_port:
label: OSC Port

View File

@@ -4,4 +4,5 @@ python-osc
customtkinter
deepl
flashtext
pyyaml
pyyaml
python-i18n

169
view.py
View File

@@ -1,7 +1,9 @@
from os import path as os_path
from typing import Union
from types import SimpleNamespace
from tkinter import font as tk_font
import webbrowser
import i18n
from languages import selectable_languages
@@ -19,6 +21,14 @@ class View():
all_uism = UiScalingManager(config.UI_SCALING)
image_file = ImageFileManager(theme)
i18n.load_path.append(os_path.join(os_path.dirname(__file__), "locales"))
i18n.set("fallback", "en") # The fallback language is English.
i18n.set("skip_locale_root_data", True)
i18n.set("filename_format", "{locale}.{format}")
i18n.set("enable_memoization", True)
i18n.set("locale", config.UI_LANGUAGE)
common_args = {
"image_file": image_file,
"FONT_FAMILY": config.FONT_FAMILY,
@@ -62,50 +72,49 @@ class View():
CALLBACK_TOGGLE_MAIN_WINDOW_SIDEBAR_COMPACT_MODE=None,
# Sidebar Features
VAR_LABEL_TRANSLATION=StringVar(value="Translation"),
VAR_LABEL_TRANSLATION=StringVar(value=i18n.t("main_window.translation")),
CALLBACK_TOGGLE_TRANSLATION=None,
VAR_LABEL_TRANSCRIPTION_SEND=StringVar(value="Voice2Chatbox"),
VAR_LABEL_TRANSCRIPTION_SEND=StringVar(value=i18n.t("main_window.transcription_send")),
CALLBACK_TOGGLE_TRANSCRIPTION_SEND=None,
VAR_LABEL_TRANSCRIPTION_RECEIVE=StringVar(value="Speaker2Log"),
VAR_LABEL_TRANSCRIPTION_RECEIVE=StringVar(value=i18n.t("main_window.transcription_receive")),
CALLBACK_TOGGLE_TRANSCRIPTION_RECEIVE=None,
VAR_LABEL_FOREGROUND=StringVar(value="Foreground"),
VAR_LABEL_FOREGROUND=StringVar(value=i18n.t("main_window.foreground")),
CALLBACK_TOGGLE_FOREGROUND=None,
# Sidebar Language Settings
VAR_LABEL_LANGUAGE_SETTINGS=StringVar(value="Language Settings"), # JA: 言語設定
VAR_LABEL_LANGUAGE_SETTINGS=StringVar(value=i18n.t("main_window.language_settings")),
LIST_SELECTABLE_LANGUAGES=[],
CALLBACK_SELECTED_LANGUAGE_PRESET_TAB=None,
VAR_LABEL_YOUR_LANGUAGE=StringVar(value="Your Language"), # JA: あなたの言語
VAR_LABEL_YOUR_LANGUAGE=StringVar(value=i18n.t("main_window.your_language")),
VAR_YOUR_LANGUAGE = StringVar(value="Japanese\n(Japan)"),
CALLBACK_OPEN_SELECTABLE_YOUR_LANGUAGE_WINDOW=None,
IS_OPENED_SELECTABLE_YOUR_LANGUAGE_WINDOW=False,
CALLBACK_SELECTED_YOUR_LANGUAGE=None,
VAR_LABEL_BOTH_DIRECTION_DESC=StringVar(value="Translate Each Other"), # JA: 双方向に翻訳
VAR_LABEL_BOTH_DIRECTION_DESC=StringVar(value=i18n.t("main_window.both_direction_desc")),
VAR_LABEL_TARGET_LANGUAGE=StringVar(value="Target Language"), # JA: 相手の言語
VAR_LABEL_TARGET_LANGUAGE=StringVar(value=i18n.t("main_window.target_language")),
VAR_TARGET_LANGUAGE = StringVar(value="English\n(United States)"),
CALLBACK_OPEN_SELECTABLE_TARGET_LANGUAGE_WINDOW=None,
IS_OPENED_SELECTABLE_TARGET_LANGUAGE_WINDOW=False,
CALLBACK_SELECTED_TARGET_LANGUAGE=None,
VAR_LABEL_TEXTBOX_ALL=StringVar(value="All"), # JA: 全て
VAR_LABEL_TEXTBOX_SENT=StringVar(value="Sent"), # JA: 送信
VAR_LABEL_TEXTBOX_RECEIVED=StringVar(value="Received"), # JA: 受信
VAR_LABEL_TEXTBOX_SYSTEM=StringVar(value="System"), # JA: システム
VAR_LABEL_TEXTBOX_ALL=StringVar(value=i18n.t("main_window.textbox_tab_all")),
VAR_LABEL_TEXTBOX_SENT=StringVar(value=i18n.t("main_window.textbox_tab_sent")),
VAR_LABEL_TEXTBOX_RECEIVED=StringVar(value=i18n.t("main_window.textbox_tab_received")),
VAR_LABEL_TEXTBOX_SYSTEM=StringVar(value=i18n.t("main_window.textbox_tab_system")),
VAR_UPDATE_AVAILABLE=StringVar(value="New version is here!"), # JA: 新しいバージョンが出ました!
# VAR_UPDATE_AVAILABLE=StringVar(value="新しいバージョンが出ました!"),
VAR_UPDATE_AVAILABLE=StringVar(value=i18n.t("main_window.update_available")),
# Selectable Language Window
VAR_TITLE_LABEL_SELECTABLE_LANGUAGE=StringVar(value=""),
VAR_GO_BACK_LABEL_SELECTABLE_LANGUAGE=StringVar(value="Go Back"),
VAR_GO_BACK_LABEL_SELECTABLE_LANGUAGE=StringVar(value=i18n.t("selectable_language_window.go_back_button")),
@@ -114,157 +123,167 @@ class View():
CALLBACK_SELECTED_SETTING_BOX_TAB=None,
IS_CONFIG_WINDOW_COMPACT_MODE=config.IS_CONFIG_WINDOW_COMPACT_MODE,
# Appearance Tab
VAR_LABEL_TRANSPARENCY=StringVar(value="Transparency"),
VAR_DESC_TRANSPARENCY=StringVar(value="Change the window's transparency. 50% to 100%. (Default: 100%)"),
# Side Menu Labels
VAR_SIDE_MENU_LABEL_APPEARANCE=StringVar(value=i18n.t("config_window.side_menu_labels.appearance")),
VAR_SIDE_MENU_LABEL_TRANSLATION=StringVar(value=i18n.t("config_window.side_menu_labels.translation")),
VAR_SIDE_MENU_LABEL_TRANSCRIPTION=StringVar(value=i18n.t("config_window.side_menu_labels.transcription")),
VAR_SECOND_TITLE_TRANSCRIPTION_MIC=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_mic")),
VAR_SECOND_TITLE_TRANSCRIPTION_SPEAKER=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_speaker")),
VAR_SIDE_MENU_LABEL_OTHERS=StringVar(value=i18n.t("config_window.side_menu_labels.others")),
VAR_SIDE_MENU_LABEL_ADVANCED_SETTINGS=StringVar(value=i18n.t("config_window.side_menu_labels.advanced_settings")),
VAR_CURRENT_ACTIVE_CONFIG_TITLE=StringVar(value=""),
VAR_LABEL_TRANSPARENCY=StringVar(value=i18n.t("config_window.transparency.label")),
VAR_DESC_TRANSPARENCY=StringVar(value=i18n.t("config_window.transparency.desc")),
SLIDER_RANGE_TRANSPARENCY=(50, 100),
CALLBACK_SET_TRANSPARENCY=None,
VAR_TRANSPARENCY=IntVar(value=config.TRANSPARENCY),
VAR_LABEL_APPEARANCE_THEME=StringVar(value="Theme"),
VAR_DESC_APPEARANCE_THEME=StringVar(value="Change the color theme from \"Light\" and \"Dark\". If you select \"System\", It will adjust based on your Windows theme. (Default: System)"),
VAR_LABEL_APPEARANCE_THEME=StringVar(value=i18n.t("config_window.appearance_theme.label")),
VAR_DESC_APPEARANCE_THEME=StringVar(value=i18n.t("config_window.appearance_theme.desc")),
LIST_APPEARANCE_THEME=["Light", "Dark", "System"],
CALLBACK_SET_APPEARANCE_THEME=None,
VAR_APPEARANCE_THEME=StringVar(value=config.APPEARANCE_THEME),
VAR_LABEL_UI_SCALING=StringVar(value="UI Size"),
VAR_DESC_UI_SCALING=StringVar(value="(Default: 100%)"),
VAR_LABEL_UI_SCALING=StringVar(value=i18n.t("config_window.ui_size.label")),
VAR_DESC_UI_SCALING=None,
LIST_UI_SCALING=["80%", "90%", "100%", "110%", "120%"],
CALLBACK_SET_UI_SCALING=None,
VAR_UI_SCALING=StringVar(value=config.UI_SCALING),
VAR_LABEL_FONT_FAMILY=StringVar(value="Font Family"),
VAR_DESC_FONT_FAMILY=StringVar(value="(Default: Yu Gothic UI)"),
VAR_LABEL_FONT_FAMILY=StringVar(value=i18n.t("config_window.font_family.label")),
VAR_DESC_FONT_FAMILY=None,
LIST_FONT_FAMILY=self.getAvailableFonts(),
CALLBACK_SET_FONT_FAMILY=None,
VAR_FONT_FAMILY=StringVar(value=config.FONT_FAMILY),
VAR_LABEL_UI_LANGUAGE=StringVar(value="UI Language"),
VAR_DESC_UI_LANGUAGE=StringVar(value="(Default: English)"),
VAR_LABEL_UI_LANGUAGE=StringVar(value=i18n.t("config_window.ui_language.label")),
VAR_DESC_UI_LANGUAGE=None,
LIST_UI_LANGUAGE=list(selectable_languages.values()),
CALLBACK_SET_UI_LANGUAGE=None,
VAR_UI_LANGUAGE=StringVar(value=selectable_languages[config.UI_LANGUAGE]),
# Translation Tab
VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value="DeepL Auth Key"),
VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value=i18n.t("config_window.deepl_auth_key.label")),
VAR_DESC_DEEPL_AUTH_KEY=None,
# VAR_DESC_DEEPL_AUTH_KEY=StringVar(value=""),
CALLBACK_SET_DEEPL_AUTH_KEY=None,
VAR_DEEPL_AUTH_KEY=StringVar(value=config.AUTH_KEYS["DeepL(auth)"]),
# Transcription Tab (Mic)
VAR_LABEL_MIC_HOST=StringVar(value="Mic Host"),
VAR_DESC_MIC_HOST=StringVar(value="Select the mic host. (Default: ?)"),
VAR_TAB_SECOND_LABEL_TRANSCRIPTION_MIC=StringVar(value=i18n.t("config_window.tab_transcription.label")),
VAR_LABEL_MIC_HOST=StringVar(value=i18n.t("config_window.mic_host.label")),
VAR_DESC_MIC_HOST=None,
LIST_MIC_HOST=[],
CALLBACK_SET_MIC_HOST=None,
VAR_MIC_HOST=StringVar(value=config.CHOICE_MIC_HOST),
VAR_LABEL_MIC_DEVICE=StringVar(value="Mic Device"),
VAR_DESC_MIC_DEVICE=StringVar(value="Select the mic devise. (Default: ?)"),
VAR_LABEL_MIC_DEVICE=StringVar(value=i18n.t("config_window.mic_device.label")),
VAR_DESC_MIC_DEVICE=None,
LIST_MIC_DEVICE=[],
CALLBACK_SET_MIC_DEVICE=None,
VAR_MIC_DEVICE=StringVar(value=config.CHOICE_MIC_DEVICE),
VAR_LABEL_MIC_ENERGY_THRESHOLD=StringVar(value="Mic Energy Threshold"),
VAR_DESC_MIC_ENERGY_THRESHOLD=StringVar(value="Slider to modify the threshold for activating voice input.\nPress the microphone button to initiate input and speak, allowing you to adjust it while monitoring the actual volume. Range: 0 to 2000 (Default: 300)"),
VAR_LABEL_MIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_energy_threshold.label")),
VAR_DESC_MIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_energy_threshold.desc")),
SLIDER_RANGE_MIC_ENERGY_THRESHOLD=(0, config.MAX_MIC_ENERGY_THRESHOLD),
CALLBACK_CHECK_MIC_THRESHOLD=None,
VAR_MIC_ENERGY_THRESHOLD__SLIDER=IntVar(value=config.INPUT_MIC_ENERGY_THRESHOLD),
VAR_MIC_ENERGY_THRESHOLD__ENTRY=StringVar(value=config.INPUT_MIC_ENERGY_THRESHOLD),
VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="Mic Dynamic Energy Threshold"),
VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="When this feature is selected, it will automatically adjust in a way that works well, based on the set Mic Energy Threshold."),
VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.label")),
VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.mic_dynamic_energy_threshold.desc")),
CALLBACK_SET_MIC_DYNAMIC_ENERGY_THRESHOLD=None,
VAR_MIC_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD),
VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value="Mic Record Timeout"),
VAR_DESC_MIC_RECORD_TIMEOUT=StringVar(value="(Default: 3)"),
VAR_LABEL_MIC_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.mic_record_timeout.label")),
VAR_DESC_MIC_RECORD_TIMEOUT=None,
CALLBACK_SET_MIC_RECORD_TIMEOUT=None,
VAR_MIC_RECORD_TIMEOUT=StringVar(value=config.INPUT_MIC_RECORD_TIMEOUT),
VAR_LABEL_MIC_PHRASE_TIMEOUT=StringVar(value="Mic Phrase Timeout"),
VAR_DESC_MIC_PHRASE_TIMEOUT=StringVar(value="(Default: 3)"),
VAR_LABEL_MIC_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.mic_phrase_timeout.label")),
VAR_DESC_MIC_PHRASE_TIMEOUT=None,
CALLBACK_SET_MIC_PHRASE_TIMEOUT=None,
VAR_MIC_PHRASE_TIMEOUT=StringVar(value=config.INPUT_MIC_PHRASE_TIMEOUT),
VAR_LABEL_MIC_MAX_PHRASES=StringVar(value="Mic Max Phrases"),
VAR_DESC_MIC_MAX_PHRASES=StringVar(value="It will stop recording and send the recordings when the set count of phrase(s) is reached. (Default: 10)"),
VAR_LABEL_MIC_MAX_PHRASES=StringVar(value=i18n.t("config_window.mic_max_phrase.label")),
VAR_DESC_MIC_MAX_PHRASES=StringVar(value=i18n.t("config_window.mic_max_phrase.desc")),
CALLBACK_SET_MIC_MAX_PHRASES=None,
VAR_MIC_MAX_PHRASES=StringVar(value=config.INPUT_MIC_MAX_PHRASES),
VAR_LABEL_MIC_WORD_FILTER=StringVar(value="Mic Word Filter"),
VAR_DESC_MIC_WORD_FILTER=StringVar(value="It will not send the sentence if the word(s) included in the set list of words.\nHow to set: e.g. AAA,BBB,CCC"),
VAR_LABEL_MIC_WORD_FILTER=StringVar(value=i18n.t("config_window.mic_word_filter.label")),
VAR_DESC_MIC_WORD_FILTER=StringVar(value=i18n.t("config_window.mic_word_filter.desc")),
CALLBACK_SET_MIC_WORD_FILTER=None,
VAR_MIC_WORD_FILTER=StringVar(value=",".join(config.INPUT_MIC_WORD_FILTER) if len(config.INPUT_MIC_WORD_FILTER) > 0 else ""),
# Transcription Tab (Speaker)
VAR_LABEL_SPEAKER_DEVICE=StringVar(value="Speaker Device"),
VAR_DESC_SPEAKER_DEVICE=StringVar(value="Select the speaker devise. (Default: ?)"),
VAR_LABEL_SPEAKER_DEVICE=StringVar(value=i18n.t("config_window.speaker_device.label")),
VAR_DESC_SPEAKER_DEVICE=None,
LIST_SPEAKER_DEVICE=[],
CALLBACK_SET_SPEAKER_DEVICE=None,
VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE),
VAR_LABEL_SPEAKER_ENERGY_THRESHOLD=StringVar(value="Speaker Energy Threshold"),
VAR_DESC_SPEAKER_ENERGY_THRESHOLD=StringVar(value="Slider to modify the threshold for activating voice input.\nPress the headphones mark button to start input and speak something, so you can adjust it while monitoring the actual volume. Range: 0 to 4000 (Default: 300)"),
VAR_LABEL_SPEAKER_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_energy_threshold.label")),
VAR_DESC_SPEAKER_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_energy_threshold.desc")),
SLIDER_RANGE_SPEAKER_ENERGY_THRESHOLD=(0, config.MAX_SPEAKER_ENERGY_THRESHOLD),
CALLBACK_CHECK_SPEAKER_THRESHOLD=None,
VAR_SPEAKER_ENERGY_THRESHOLD__SLIDER=IntVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD),
VAR_SPEAKER_ENERGY_THRESHOLD__ENTRY=StringVar(value=config.INPUT_SPEAKER_ENERGY_THRESHOLD),
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="Speaker Dynamic Energy Threshold"),
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value="When this feature is selected, it will automatically adjust in a way that works well, based on the set Speaker Energy Threshold."),
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.label")),
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=i18n.t("config_window.speaker_dynamic_energy_threshold.desc")),
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
VAR_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=BooleanVar(value=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD),
VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value="Speaker Record Timeout"),
VAR_DESC_SPEAKER_RECORD_TIMEOUT=StringVar(value="(Default: 3)"),
VAR_LABEL_SPEAKER_RECORD_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_record_timeout.label")),
VAR_DESC_SPEAKER_RECORD_TIMEOUT=None,
CALLBACK_SET_SPEAKER_RECORD_TIMEOUT=None,
VAR_SPEAKER_RECORD_TIMEOUT=StringVar(value=config.INPUT_SPEAKER_RECORD_TIMEOUT),
VAR_LABEL_SPEAKER_PHRASE_TIMEOUT=StringVar(value="Speaker Phrase Timeout"),
VAR_DESC_SPEAKER_PHRASE_TIMEOUT=StringVar(value="It will stop recording and receive the recordings when the set second(s) is reached. (Default: 3)"),
VAR_LABEL_SPEAKER_PHRASE_TIMEOUT=StringVar(value=i18n.t("config_window.speaker_phrase_timeout.label")),
VAR_DESC_SPEAKER_PHRASE_TIMEOUT=None,
CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT=None,
VAR_SPEAKER_PHRASE_TIMEOUT=StringVar(value=config.INPUT_SPEAKER_PHRASE_TIMEOUT),
VAR_LABEL_SPEAKER_MAX_PHRASES=StringVar(value="Speaker Max Phrases"),
VAR_DESC_SPEAKER_MAX_PHRASES=StringVar(value="It will stop recording and receive the recordings when the set count of phrase(s) is reached. (Default: 10)"),
VAR_LABEL_SPEAKER_MAX_PHRASES=StringVar(value=i18n.t("config_window.speaker_max_phrase.label")),
VAR_DESC_SPEAKER_MAX_PHRASES=StringVar(value=i18n.t("config_window.speaker_max_phrase.desc")),
CALLBACK_SET_SPEAKER_MAX_PHRASES=None,
VAR_SPEAKER_MAX_PHRASES=StringVar(value=config.INPUT_SPEAKER_MAX_PHRASES),
# Others Tab
VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value="Auto Clear The Message Box"),
VAR_DESC_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value="Clear the message box after sending your message."),
VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value=i18n.t("config_window.auto_clear_the_message_box.label")),
VAR_DESC_ENABLE_AUTO_CLEAR_MESSAGE_BOX=None,
CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX=None,
VAR_ENABLE_AUTO_CLEAR_MESSAGE_BOX=BooleanVar(value=config.ENABLE_AUTO_CLEAR_MESSAGE_BOX),
VAR_LABEL_ENABLE_NOTICE_XSOVERLAY=StringVar(value="Notification XSOverlay (VR Only)"),
VAR_DESC_ENABLE_NOTICE_XSOVERLAY=StringVar(value="Notify received messages by using XSOverlay's notification feature."),
VAR_LABEL_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.label")),
VAR_DESC_ENABLE_NOTICE_XSOVERLAY=StringVar(value=i18n.t("config_window.notice_xsoverlay.desc")),
CALLBACK_SET_ENABLE_NOTICE_XSOVERLAY=None,
VAR_ENABLE_NOTICE_XSOVERLAY=BooleanVar(value=config.ENABLE_NOTICE_XSOVERLAY),
VAR_LABEL_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=StringVar(value="Auto Export Message Logs"),
VAR_DESC_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=StringVar(value="Automatically export the conversation messages as a text file."),
VAR_LABEL_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=StringVar(value=i18n.t("config_window.auto_export_message_logs.label")),
VAR_DESC_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=StringVar(value=i18n.t("config_window.auto_export_message_logs.desc")),
CALLBACK_SET_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=None,
VAR_ENABLE_AUTO_EXPORT_MESSAGE_LOGS=BooleanVar(value=config.ENABLE_LOGGER),
VAR_LABEL_MESSAGE_FORMAT=StringVar(value="Message Format"),
VAR_DESC_MESSAGE_FORMAT=StringVar(value="You can change the decoration of the message you want to send. (Default: \"[message]([translation])\" )"),
VAR_LABEL_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.message_format.label")),
VAR_DESC_MESSAGE_FORMAT=StringVar(value=i18n.t("config_window.message_format.desc")),
CALLBACK_SET_MESSAGE_FORMAT=None,
VAR_MESSAGE_FORMAT=StringVar(value=config.MESSAGE_FORMAT),
VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value="Send Message To VRChat"),
VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value="There is a way to use it without sending messages to VRChat.\nThat is not covered by support, though."),
VAR_LABEL_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.label")),
VAR_DESC_ENABLE_SEND_MESSAGE_TO_VRC=StringVar(value=i18n.t("config_window.send_message_to_vrc.desc")),
CALLBACK_SET_ENABLE_SEND_MESSAGE_TO_VRC=None,
VAR_ENABLE_SEND_MESSAGE_TO_VRC=BooleanVar(value=config.ENABLE_SEND_MESSAGE_TO_VRC),
VAR_LABEL_STARTUP_OSC_ENABLED_CHECK=StringVar(value="Check If OSC Is Enabled At Startup"),
VAR_DESC_STARTUP_OSC_ENABLED_CHECK=StringVar(value="Every time VRCT is started up, your character in VRChat moves forward ever so slightly. If your character is seated, they might even stand up. Unfortunately, this is the only method we've found to check if OSC is enabled at startup... Sorry about that. (Remember to turn on OSC yourself when you want to send messages to VRChat.)"),
VAR_LABEL_STARTUP_OSC_ENABLED_CHECK=StringVar(value=i18n.t("config_window.startup_osc_enabled_check.label")),
VAR_DESC_STARTUP_OSC_ENABLED_CHECK=StringVar(value=i18n.t("config_window.startup_osc_enabled_check.desc")),
CALLBACK_SET_STARTUP_OSC_ENABLED_CHECK=None,
VAR_STARTUP_OSC_ENABLED_CHECK=BooleanVar(value=config.STARTUP_OSC_ENABLED_CHECK),
@@ -272,13 +291,13 @@ class View():
# Advanced Settings Tab
VAR_LABEL_OSC_IP_ADDRESS=StringVar(value="OSC IP Address"),
VAR_DESC_OSC_IP_ADDRESS=StringVar(value="(Default: 127.0.0.1)"),
VAR_LABEL_OSC_IP_ADDRESS=StringVar(value=i18n.t("config_window.osc_ip_address.label")),
VAR_DESC_OSC_IP_ADDRESS=None,
CALLBACK_SET_OSC_IP_ADDRESS=None,
VAR_OSC_IP_ADDRESS=StringVar(value=config.OSC_IP_ADDRESS),
VAR_LABEL_OSC_PORT=StringVar(value="OSC Port"),
VAR_DESC_OSC_PORT=StringVar(value="(Default: 9000)"),
VAR_LABEL_OSC_PORT=StringVar(value=i18n.t("config_window.osc_port.label")),
VAR_DESC_OSC_PORT=None,
CALLBACK_SET_OSC_PORT=None,
VAR_OSC_PORT=StringVar(value=config.OSC_PORT),
)
@@ -456,10 +475,10 @@ class View():
vrct_gui.recreateMainWindowSidebar()
def openSelectableLanguagesWindow_YourLanguage(self, _e):
self.view_variable.VAR_TITLE_LABEL_SELECTABLE_LANGUAGE.set("Your Language")
self.view_variable.VAR_TITLE_LABEL_SELECTABLE_LANGUAGE.set(i18n.t("selectable_language_window.title_your_language"))
vrct_gui.openSelectableLanguagesWindow("your_language")
def openSelectableLanguagesWindow_TargetLanguage(self, _e):
self.view_variable.VAR_TITLE_LABEL_SELECTABLE_LANGUAGE.set("Target Language")
self.view_variable.VAR_TITLE_LABEL_SELECTABLE_LANGUAGE.set(i18n.t("selectable_language_window.title_target_language"))
vrct_gui.openSelectableLanguagesWindow("target_language")

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel
def _createSettingBoxTitle(parent_widget, config_window, settings):
def _createSettingBoxTitle(parent_widget, config_window, settings, view_variable):
parent_widget.grid_columnconfigure(0, weight=1)
config_window.main_current_active_config_title_container = CTkFrame(parent_widget, corner_radius=0, fg_color=settings.ctm.TOP_BAR_BG_COLOR, width=0, height=0)
@@ -11,7 +11,7 @@ def _createSettingBoxTitle(parent_widget, config_window, settings):
config_window.main_current_active_config_title = CTkLabel(
config_window.main_current_active_config_title_container,
height=0,
text=None,
textvariable=view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE,
anchor="w",
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.TOP_BAR_MAIN__TITLE_FONT_SIZE, weight="bold"),
text_color=settings.ctm.LABELS_TEXT_COLOR

View File

@@ -10,6 +10,6 @@ def createSettingBoxTopBar(config_window, settings, view_variable):
config_window.setting_box_top_bar.grid(row=0, column=1, sticky="nsew")
_createSettingBoxTitle(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings)
_createSettingBoxTitle(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable)
_createSettingBoxCompactModeButton(parent_widget=config_window.setting_box_top_bar, config_window=config_window, settings=settings, view_variable=view_variable)

View File

@@ -51,8 +51,8 @@ def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_set
config_window.main_setting_box_scrollable_container._parent_canvas.yview_moveto("0")
def switchToTargetSettingBoxContainer(e, text, target_active_tab_widget_attr_name, target_setting_box_container_attr_name):
config_window.main_current_active_config_title.configure(text=text)
def switchToTargetSettingBoxContainer(textvariable, target_active_tab_widget_attr_name, target_setting_box_container_attr_name):
view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(textvariable.get())
target_active_tab_widget = getattr(config_window, target_active_tab_widget_attr_name)
switchSettingBoxContainerTabFunction(target_active_tab_widget)
switchSettingBoxContainer(target_setting_box_container_attr_name)
@@ -65,11 +65,10 @@ def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_set
side_menu_tab_attr_name = side_menu_settings["side_menu_tab_attr_name"]
label_attr_name = side_menu_settings["label_attr_name"]
selected_mark_attr_name = side_menu_settings["selected_mark_attr_name"]
text = side_menu_settings["text"]
textvariable = side_menu_settings["textvariable"]
setting_box_container_attr_name = side_menu_settings["setting_box_container_settings"]["setting_box_container_attr_name"]
command = lambda e: switchToTargetSettingBoxContainer(
e=e,
text=text,
command = lambda _e: switchToTargetSettingBoxContainer(
textvariable=textvariable,
target_active_tab_widget_attr_name=side_menu_tab_attr_name,
target_setting_box_container_attr_name=setting_box_container_attr_name,
)
@@ -84,7 +83,7 @@ def _addConfigSideMenuItem(config_window, settings, view_variable, side_menu_set
label_widget = CTkLabel(
frame_widget,
text=text,
textvariable=textvariable,
height=0,
corner_radius=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SIDE_MENU_LABELS_FONT_SIZE, weight="normal"),

View File

@@ -4,12 +4,12 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel
def _createSettingBoxContainer(config_window, settings, view_variable, setting_box_container_settings):
def createSectionTitle(container_widget, section_title):
def createSectionTitle(container_widget, var_section_title):
setting_box_wrapper_section_title_frame = CTkFrame(container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=0)
setting_box_wrapper_section_title = CTkLabel(
setting_box_wrapper_section_title_frame,
text=section_title,
textvariable=var_section_title,
anchor="w",
height=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.SB__SECTION_TITLE_FONT_SIZE, weight="normal"),
@@ -35,10 +35,10 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b
setting_box_and_section_title_wrapper = CTkFrame(setting_box_container_widget, fg_color=settings.ctm.SB__WRAPPER_BG_COLOR, corner_radius=0, width=0, height=0)
if setting_box_setting["section_title"] is not None:
if setting_box_setting["var_section_title"] is not None:
setting_box_wrapper_section_title_frame= createSectionTitle(
container_widget=setting_box_and_section_title_wrapper,
section_title=setting_box_setting["section_title"],
var_section_title=setting_box_setting["var_section_title"],
)
setting_box_wrapper_section_title_frame.grid(row=0, column=0, sticky="ew", padx=0, pady=0)
if i == 0: SB__TOP_PADY = settings.uism.SB__TOP_PADY_IF_WITH_SECTION_TITLE

View File

@@ -52,11 +52,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
"side_menu_tab_attr_name": "side_menu_tab_appearance",
"label_attr_name": "label_appearance",
"selected_mark_attr_name": "selected_mark_appearance",
"text": "Appearance",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_APPEARANCE,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_appearance",
"setting_boxes": [
{ "section_title": None, "setting_box": createSettingBox_Appearance },
{ "var_section_title": None, "setting_box": createSettingBox_Appearance },
]
},
},
@@ -64,11 +64,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
"side_menu_tab_attr_name": "side_menu_tab_translation",
"label_attr_name": "label_translation",
"selected_mark_attr_name": "selected_mark_translation",
"text": "Translation",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_TRANSLATION,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_translation",
"setting_boxes": [
{ "section_title": None, "setting_box": createSettingBox_Translation },
{ "var_section_title": None, "setting_box": createSettingBox_Translation },
]
},
},
@@ -76,12 +76,18 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
"side_menu_tab_attr_name": "side_menu_tab_transcription",
"label_attr_name": "label_transcription",
"selected_mark_attr_name": "selected_mark_transcription",
"text": "Transcription",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_TRANSCRIPTION,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_transcription",
"setting_boxes": [
{ "section_title": "Mic", "setting_box": createSettingBox_Mic },
{ "section_title": "Speaker", "setting_box": createSettingBox_Speaker },
{
"var_section_title": view_variable.VAR_SECOND_TITLE_TRANSCRIPTION_MIC,
"setting_box": createSettingBox_Mic
},
{
"var_section_title": view_variable.VAR_SECOND_TITLE_TRANSCRIPTION_SPEAKER,
"setting_box": createSettingBox_Speaker
},
]
},
},
@@ -89,11 +95,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
"side_menu_tab_attr_name": "side_menu_tab_others",
"label_attr_name": "label_others",
"selected_mark_attr_name": "selected_mark_others",
"text": "Others",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_OTHERS,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_others",
"setting_boxes": [
{ "section_title": None, "setting_box": createSettingBox_Others },
{ "var_section_title": None, "setting_box": createSettingBox_Others },
]
},
},
@@ -101,11 +107,11 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
"side_menu_tab_attr_name": "side_menu_tab_advanced",
"label_attr_name": "label_advanced",
"selected_mark_attr_name": "selected_mark_advanced",
"text": "Advanced Settings",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_ADVANCED_SETTINGS,
"setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_advanced",
"setting_boxes": [
{ "section_title": None, "setting_box": createSettingBox_AdvancedSettings },
{ "var_section_title": None, "setting_box": createSettingBox_AdvancedSettings },
]
},
},
@@ -138,7 +144,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
if sm_and_sbc_setting["side_menu_tab_attr_name"] == view_variable.ACTIVE_SETTING_BOX_TAB_ATTR_NAME:
# Set default active side menu tab
config_window.main_current_active_config_title.configure(text=sm_and_sbc_setting["text"])
view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(sm_and_sbc_setting["textvariable"].get())
config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"])
_setDefaultActiveTab(
active_tab_widget=config_window.current_active_side_menu_tab,