[Update] Config Window: Localization. 各項目のタイトルを変数化、多言語対応。(それに合わせて切り替え処理も)
This commit is contained in:
@@ -17,11 +17,21 @@ main_window:
|
||||
update_available: New version is here!
|
||||
|
||||
selectable_language_window:
|
||||
your_language: Your Language
|
||||
target_language: Target Language
|
||||
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.
|
||||
|
||||
@@ -17,11 +17,21 @@ main_window:
|
||||
update_available: 新しいバージョンが出ました!
|
||||
|
||||
selectable_language_window:
|
||||
your_language: あなたの言語
|
||||
target_language: 相手の言語
|
||||
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: メイン画面の透明度を変更できます。
|
||||
@@ -35,5 +45,6 @@ config_window:
|
||||
ui_language:
|
||||
label: UIの言語
|
||||
|
||||
tab_translation: 翻訳
|
||||
deepl_auth_key:
|
||||
label: DeepL 認証キー
|
||||
19
view.py
19
view.py
@@ -123,7 +123,17 @@ class View():
|
||||
CALLBACK_SELECTED_SETTING_BOX_TAB=None,
|
||||
IS_CONFIG_WINDOW_COMPACT_MODE=config.IS_CONFIG_WINDOW_COMPACT_MODE,
|
||||
|
||||
# Appearance Tab
|
||||
# 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),
|
||||
@@ -155,7 +165,7 @@ class View():
|
||||
VAR_UI_LANGUAGE=StringVar(value=selectable_languages[config.UI_LANGUAGE]),
|
||||
|
||||
|
||||
# Translation Tab
|
||||
|
||||
VAR_LABEL_DEEPL_AUTH_KEY=StringVar(value=i18n.t("config_window.deepl_auth_key.label")),
|
||||
VAR_DESC_DEEPL_AUTH_KEY=None,
|
||||
CALLBACK_SET_DEEPL_AUTH_KEY=None,
|
||||
@@ -163,6 +173,7 @@ class View():
|
||||
|
||||
|
||||
# Transcription Tab (Mic)
|
||||
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=[],
|
||||
@@ -464,10 +475,10 @@ class View():
|
||||
vrct_gui.recreateMainWindowSidebar()
|
||||
|
||||
def openSelectableLanguagesWindow_YourLanguage(self, _e):
|
||||
self.view_variable.VAR_TITLE_LABEL_SELECTABLE_LANGUAGE.set(i18n.t("selectable_language_window.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(i18n.t("selectable_language_window.target_language"))
|
||||
self.view_variable.VAR_TITLE_LABEL_SELECTABLE_LANGUAGE.set(i18n.t("selectable_language_window.title_target_language"))
|
||||
vrct_gui.openSelectableLanguagesWindow("target_language")
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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"),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user