SciPIP / src /app_pages /locale.py
lihuigu's picture
update UI
88253fe
raw
history blame contribute delete
378 Bytes
import json
import streamlit as st
json_contents = json.loads(open("./src/app_pages/locale.json", "r").read())
def _(content: str):
if st.session_state.get("language", "en") == "en":
return content
a = json_contents.get(content, content)
if isinstance(a, dict):
return a.get(st.session_state["language"], content)
else:
return content