diff --git a/package_build/i18n.py b/package_build/i18n.py index d7b9474..325cd4f 100644 --- a/package_build/i18n.py +++ b/package_build/i18n.py @@ -2,16 +2,19 @@ import time from pathlib import Path +import streamlit as st from streamlit_javascript import st_javascript def get_preferred_languages() -> list[str]: - while True: - languages = st_javascript("navigator.languages") - if languages: - return languages + with st.empty(): + while True: + languages = st_javascript("window.navigator.languages") - time.sleep(0.1) + if languages: + return languages + + time.sleep(0.1) locale_dir = Path(__file__).parent / "locale"