File size: 1,117 Bytes
1bf4da3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3e3b049
1bf4da3
 
3e3b049
1bf4da3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
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]),
    )