Spaces:
Sleeping
Sleeping
johannoriel
commited on
Commit
•
9c791eb
1
Parent(s):
f34a6fd
Missing file
Browse files- global_vars.py +30 -0
global_vars.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# global_vars.py
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
def get_lang():
|
5 |
+
return st.session_state.get('lang', 'en')
|
6 |
+
|
7 |
+
def set_lang(new_lang):
|
8 |
+
st.session_state['lang'] = new_lang
|
9 |
+
|
10 |
+
# Dictionnaire de traduction global
|
11 |
+
translations = {
|
12 |
+
"en": {
|
13 |
+
"page_title": "YoutTools : YouTube Channel helpers",
|
14 |
+
"navigation": "Navigation",
|
15 |
+
"configurations": "Configurations",
|
16 |
+
"save_button": "Save Configuration",
|
17 |
+
"success_message": "Configuration saved!",
|
18 |
+
},
|
19 |
+
"fr": {
|
20 |
+
"page_title": "YoutTools : Outils pour chaîne YouTube",
|
21 |
+
"navigation": "Navigation",
|
22 |
+
"configurations": "Configurations",
|
23 |
+
"save_button": "Sauvegarder la configuration",
|
24 |
+
"success_message": "Configuration sauvegardée!",
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
# Fonction de traduction
|
29 |
+
def t(key: str) -> str:
|
30 |
+
return translations[get_lang()].get(key, key)
|