feat: optimize code
This commit is contained in:
@@ -57,6 +57,16 @@ i18n_dir = os.path.join(root_dir, "webui", "i18n")
|
|||||||
config_file = os.path.join(root_dir, "webui", ".streamlit", "webui.toml")
|
config_file = os.path.join(root_dir, "webui", ".streamlit", "webui.toml")
|
||||||
system_locale = utils.get_system_locale()
|
system_locale = utils.get_system_locale()
|
||||||
|
|
||||||
|
|
||||||
|
if "video_subject" not in st.session_state:
|
||||||
|
st.session_state["video_subject"] = ""
|
||||||
|
if "video_script" not in st.session_state:
|
||||||
|
st.session_state["video_script"] = ""
|
||||||
|
if "video_terms" not in st.session_state:
|
||||||
|
st.session_state["video_terms"] = ""
|
||||||
|
if "ui_language" not in st.session_state:
|
||||||
|
st.session_state["ui_language"] = config.ui.get("language", system_locale)
|
||||||
|
|
||||||
# 加载语言文件
|
# 加载语言文件
|
||||||
locales = utils.load_locales(i18n_dir)
|
locales = utils.load_locales(i18n_dir)
|
||||||
|
|
||||||
@@ -97,16 +107,6 @@ support_locales = [
|
|||||||
"th-TH",
|
"th-TH",
|
||||||
]
|
]
|
||||||
|
|
||||||
if "video_subject" not in st.session_state:
|
|
||||||
st.session_state["video_subject"] = ""
|
|
||||||
if "video_script" not in st.session_state:
|
|
||||||
st.session_state["video_script"] = ""
|
|
||||||
if "video_terms" not in st.session_state:
|
|
||||||
st.session_state["video_terms"] = ""
|
|
||||||
if "ui_language" not in st.session_state:
|
|
||||||
st.session_state["ui_language"] = config.ui.get("language", system_locale)
|
|
||||||
|
|
||||||
|
|
||||||
def get_all_fonts():
|
def get_all_fonts():
|
||||||
fonts = []
|
fonts = []
|
||||||
for root, dirs, files in os.walk(font_dir):
|
for root, dirs, files in os.walk(font_dir):
|
||||||
|
|||||||
Reference in New Issue
Block a user