rafaldembski commited on
Commit
b7b91ab
1 Parent(s): a4f1359

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -19
app.py CHANGED
@@ -32,8 +32,8 @@ translations = {
32
  'menu_statistics': 'Statystyki',
33
  'menu_contact': 'Kontakt',
34
  'language_select': 'Wybierz język',
35
- 'separator': '---'
36
- # ... dodaj inne tłumaczenia
37
  },
38
  'German': {
39
  'menu_analysis_sms': 'SMS-Analyse',
@@ -42,8 +42,8 @@ translations = {
42
  'menu_statistics': 'Statistiken',
43
  'menu_contact': 'Kontakt',
44
  'language_select': 'Sprache auswählen',
45
- 'separator': '---'
46
- # ... dodaj inne tłumaczenia
47
  },
48
  'English': {
49
  'menu_analysis_sms': 'SMS Analysis',
@@ -52,29 +52,35 @@ translations = {
52
  'menu_statistics': 'Statistics',
53
  'menu_contact': 'Contact',
54
  'language_select': 'Select Language',
55
- 'separator': '---'
56
- # ... dodaj inne tłumaczenia
57
  }
58
  }
59
 
60
- # 4. Language selection
61
  if 'language' not in st.session_state:
62
  st.session_state.language = 'Polish'
63
 
64
- def set_language():
65
- st.session_state.language = st.session_state.language_select
66
-
67
- # Wyświetlenie wyboru języka na górze aplikacji
68
- st.radio(
69
- translations['Polish']['language_select'],
70
- ('Polish', 'German', 'English'),
71
- key='language_select',
72
- index=['Polish', 'German', 'English'].index(st.session_state.language),
73
- on_change=set_language
74
- )
 
 
 
 
75
 
76
  selected_language = st.session_state.language
77
 
 
 
78
  # 5. Fetch translated menu options
79
  menu_keys = ['menu_analysis_sms', 'menu_about', 'menu_education', 'menu_statistics', 'menu_contact']
80
  menu_options = [translations[selected_language][key] for key in menu_keys]
@@ -154,7 +160,7 @@ st.markdown("---") # Dodaje poziomą linię
154
 
155
  # 9. Importowanie i wywoływanie modułów dla każdej zakładki
156
  if selected == translations[selected_language]['menu_analysis_sms']:
157
- from pages.Analysis import show_analysis
158
  show_analysis(selected_language)
159
  elif selected == translations[selected_language]['menu_about']:
160
  from pages.About import main as show_about
 
32
  'menu_statistics': 'Statystyki',
33
  'menu_contact': 'Kontakt',
34
  'language_select': 'Wybierz język',
35
+ 'separator': '---',
36
+ 'language_selected': 'Wybrany język: '
37
  },
38
  'German': {
39
  'menu_analysis_sms': 'SMS-Analyse',
 
42
  'menu_statistics': 'Statistiken',
43
  'menu_contact': 'Kontakt',
44
  'language_select': 'Sprache auswählen',
45
+ 'separator': '---',
46
+ 'language_selected': 'Ausgewählte Sprache: '
47
  },
48
  'English': {
49
  'menu_analysis_sms': 'SMS Analysis',
 
52
  'menu_statistics': 'Statistics',
53
  'menu_contact': 'Contact',
54
  'language_select': 'Select Language',
55
+ 'separator': '---',
56
+ 'language_selected': 'Selected Language: '
57
  }
58
  }
59
 
60
+ # 4. Language selection with flags
61
  if 'language' not in st.session_state:
62
  st.session_state.language = 'Polish'
63
 
64
+ def set_language(lang):
65
+ st.session_state.language = lang
66
+
67
+ # Wyświetlenie wyboru języka z flagami
68
+ st.markdown("### " + translations['Polish']['language_select'])
69
+ col1, col2, col3 = st.columns(3)
70
+ with col1:
71
+ if st.button('🇵🇱'):
72
+ set_language('Polish')
73
+ with col2:
74
+ if st.button('🇩🇪'):
75
+ set_language('German')
76
+ with col3:
77
+ if st.button('🇬🇧'):
78
+ set_language('English')
79
 
80
  selected_language = st.session_state.language
81
 
82
+ st.markdown(f"**{translations[selected_language]['language_selected']} {selected_language}**")
83
+
84
  # 5. Fetch translated menu options
85
  menu_keys = ['menu_analysis_sms', 'menu_about', 'menu_education', 'menu_statistics', 'menu_contact']
86
  menu_options = [translations[selected_language][key] for key in menu_keys]
 
160
 
161
  # 9. Importowanie i wywoływanie modułów dla każdej zakładki
162
  if selected == translations[selected_language]['menu_analysis_sms']:
163
+ from pages.Analysis import main as show_analysis
164
  show_analysis(selected_language)
165
  elif selected == translations[selected_language]['menu_about']:
166
  from pages.About import main as show_about