Spaces:
Running
Running
Alejandro Cremades
commited on
Commit
•
b6d4315
1
Parent(s):
5498a10
Save selected language on session state
Browse files
Middle_School_Card_Search.py
CHANGED
@@ -9,6 +9,8 @@ _ = streamlit_common.locale.get_locale()
|
|
9 |
|
10 |
if "number_shown_results" not in st.session_state:
|
11 |
st.session_state["number_shown_results"] = 20
|
|
|
|
|
12 |
|
13 |
|
14 |
def add_more_results():
|
@@ -27,8 +29,10 @@ st.set_page_config(
|
|
27 |
lang = st.sidebar.radio(
|
28 |
label="Language / 言語",
|
29 |
options=["English", "日本語"],
|
|
|
30 |
)
|
31 |
-
|
|
|
32 |
headcol1, headcol2 = st.columns([1, 7])
|
33 |
headcol1.image("favicon.ico", width=80)
|
34 |
headcol2.write(f"# Middle School Tutor")
|
|
|
9 |
|
10 |
if "number_shown_results" not in st.session_state:
|
11 |
st.session_state["number_shown_results"] = 20
|
12 |
+
if "lang" not in st.session_state:
|
13 |
+
st.session_state["lang"] = "en"
|
14 |
|
15 |
|
16 |
def add_more_results():
|
|
|
29 |
lang = st.sidebar.radio(
|
30 |
label="Language / 言語",
|
31 |
options=["English", "日本語"],
|
32 |
+
index=1 if st.session_state["lang"] == "ja" else 0,
|
33 |
)
|
34 |
+
st.session_state["lang"] = "ja" if lang == "日本語" else "en"
|
35 |
+
l = st.session_state["lang"]
|
36 |
headcol1, headcol2 = st.columns([1, 7])
|
37 |
headcol1.image("favicon.ico", width=80)
|
38 |
headcol2.write(f"# Middle School Tutor")
|
pages/1_Check_Card_List.py
CHANGED
@@ -7,6 +7,9 @@ import streamlit_common.locale
|
|
7 |
mslist_path = "output/middleschool.csv"
|
8 |
_ = streamlit_common.locale.get_locale()
|
9 |
|
|
|
|
|
|
|
10 |
st.set_page_config(
|
11 |
page_title="Middle School Tutor | Check Card List",
|
12 |
page_icon="favicon.ico",
|
@@ -15,8 +18,10 @@ st.set_page_config(
|
|
15 |
lang = st.sidebar.radio(
|
16 |
label="Language / 言語",
|
17 |
options=["English", "日本語"],
|
|
|
18 |
)
|
19 |
-
|
|
|
20 |
headcol1, headcol2 = st.columns([1, 7])
|
21 |
headcol1.image("favicon.ico", width=80)
|
22 |
headcol2.write(f"# Middle School Tutor")
|
|
|
7 |
mslist_path = "output/middleschool.csv"
|
8 |
_ = streamlit_common.locale.get_locale()
|
9 |
|
10 |
+
if "lang" not in st.session_state:
|
11 |
+
st.session_state["lang"] = "en"
|
12 |
+
|
13 |
st.set_page_config(
|
14 |
page_title="Middle School Tutor | Check Card List",
|
15 |
page_icon="favicon.ico",
|
|
|
18 |
lang = st.sidebar.radio(
|
19 |
label="Language / 言語",
|
20 |
options=["English", "日本語"],
|
21 |
+
index=1 if st.session_state["lang"] == "ja" else 0,
|
22 |
)
|
23 |
+
st.session_state["lang"] = "ja" if lang == "日本語" else "en"
|
24 |
+
l = st.session_state["lang"]
|
25 |
headcol1, headcol2 = st.columns([1, 7])
|
26 |
headcol1.image("favicon.ico", width=80)
|
27 |
headcol2.write(f"# Middle School Tutor")
|