OCEANAI / app /event_handlers /languages.py
DmitryRyumin's picture
Summary
c3645b6
raw
history blame
1.14 kB
"""
File: languages.py
Author: Elena Ryumina and Dmitry Ryumin
Description: Selected language event handlers for Gradio app.
License: MIT License
"""
import gradio as gr
# Importing necessary components for the Gradio app
from app.config import config_data
from app.components import dropdown_create_ui
def event_handler_languages(languages):
if languages.lower() == "πŸ‡¬πŸ‡§ english":
lang_id = 0
choices = config_data.Settings_LANGUAGES_EN
elif languages.lower() == "πŸ‡·πŸ‡Ί russian":
lang_id = 1
choices = config_data.Settings_LANGUAGES_RU
else:
lang_id = 0
choices = config_data.Settings_LANGUAGES_EN
return (
dropdown_create_ui(
label=None,
info=None,
choices=choices,
value=choices[lang_id],
visible=True,
show_label=False,
elem_classes="dropdown-language-container",
),
gr.Tab(config_data.Labels_APP_LABEL[lang_id]),
gr.Tab(config_data.Labels_ABOUT_APP_LABEL[lang_id]),
gr.Tab(config_data.Labels_ABOUT_AUTHORS_LABEL[lang_id]),
)