File size: 365 Bytes
a8a7773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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