limloop's picture
docker
f78fd27
raw
history blame contribute delete
365 Bytes
import json
from pathlib import Path
import streamlit as st
locales_dir = Path("locales")
@st.cache_data
def lang_codes():
return [l.stem for l in locales_dir.glob("*.json")]
@st.cache_data
def load_locale(lang):
locale = {}
locale_dir = locales_dir / f"{lang}.json"
with open(locale_dir, "r", encoding="utf-8") as f:
locale = json.load(f)
return locale