Skip to content

Commit

Permalink
Trying to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
insolor committed Jul 21, 2024
1 parent 82388d3 commit ff86d27
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions package_build/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
import time
from pathlib import Path

import streamlit as st
from streamlit_javascript import st_javascript

with st.empty():
@st.cache_resource
def get_preferred_languages() -> list[str]:
while True:
languages = st_javascript("navigator.languages")
if languages:
return languages

time.sleep(0.1)
def get_preferred_languages() -> list[str]:
while True:
languages = st_javascript("navigator.languages")
if languages:
return languages

time.sleep(0.1)


locale_dir = Path(__file__).parent / "locale"

languages = get_preferred_languages()

lang = gettext.translation(
"messages",
localedir=str(locale_dir),
Expand Down

0 comments on commit ff86d27

Please sign in to comment.