File size: 378 Bytes
479f67b
 
 
 
 
 
88253fe
479f67b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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