Spaces:
Running
Running
Commit
·
ffae291
1
Parent(s):
a4afdcc
init
Browse files- __lib__/app.py +14 -17
- __lib__/i18n/ar.pyc +0 -0
- __lib__/i18n/da.pyc +0 -0
- __lib__/i18n/de.pyc +0 -0
- __lib__/i18n/en.pyc +0 -0
- __lib__/i18n/es.pyc +0 -0
- __lib__/i18n/fi.pyc +0 -0
- __lib__/i18n/fr.pyc +0 -0
- __lib__/i18n/he.pyc +0 -0
- __lib__/i18n/hi.pyc +0 -0
- __lib__/i18n/id.pyc +0 -0
- __lib__/i18n/it.pyc +0 -0
- __lib__/i18n/ja.pyc +0 -0
- __lib__/i18n/nl.pyc +0 -0
- __lib__/i18n/no.pyc +0 -0
- __lib__/i18n/pt.pyc +0 -0
- __lib__/i18n/ru.pyc +0 -0
- __lib__/i18n/sv.pyc +0 -0
- __lib__/i18n/tr.pyc +0 -0
- __lib__/i18n/uk.pyc +0 -0
- __lib__/i18n/vi.pyc +0 -0
- __lib__/i18n/zh.pyc +0 -0
__lib__/app.py
CHANGED
|
@@ -1049,15 +1049,17 @@ def create_app():
|
|
| 1049 |
""", visible=True)
|
| 1050 |
|
| 1051 |
with gr.Column(scale=0, min_width=160, elem_classes=["banner-lang-selector"]):
|
|
|
|
| 1052 |
lang_dropdown = gr.Dropdown(
|
| 1053 |
choices=[
|
| 1054 |
-
("English", "en")
|
| 1055 |
],
|
| 1056 |
value="en",
|
| 1057 |
label="🌐",
|
| 1058 |
show_label=True,
|
| 1059 |
interactive=True,
|
| 1060 |
-
container=False
|
|
|
|
| 1061 |
)
|
| 1062 |
|
| 1063 |
with gr.Tabs() as tabs:
|
|
@@ -1378,7 +1380,8 @@ def create_app():
|
|
| 1378 |
}
|
| 1379 |
|
| 1380 |
def on_lang_change(lang):
|
| 1381 |
-
|
|
|
|
| 1382 |
|
| 1383 |
lang_dropdown.change(
|
| 1384 |
on_lang_change,
|
|
@@ -1430,24 +1433,18 @@ def create_app():
|
|
| 1430 |
try:
|
| 1431 |
# Check if IP is already cached (second+ visit)
|
| 1432 |
if client_ip in IP_Country_Cache:
|
| 1433 |
-
# Use cached data -
|
| 1434 |
-
cached_lang =
|
| 1435 |
-
|
| 1436 |
-
|
| 1437 |
-
|
| 1438 |
-
query_state = {"ip": client_ip, "cached": True}
|
| 1439 |
-
return cached_lang, cached_lang, query_state, *update_ui_lang(cached_lang).values()
|
| 1440 |
|
| 1441 |
# First visit: Query IP and determine language (max 3s timeout built-in)
|
| 1442 |
print(f"First visit - detecting language for IP: {client_ip}")
|
| 1443 |
-
|
|
|
|
| 1444 |
|
| 1445 |
-
|
| 1446 |
-
if not detected_lang or len(detected_lang) != 2:
|
| 1447 |
-
print(f"Invalid detected language '{detected_lang}', using English")
|
| 1448 |
-
detected_lang = "en"
|
| 1449 |
-
|
| 1450 |
-
print(f"First visit - Final language: {detected_lang} for IP: {client_ip}")
|
| 1451 |
query_state = {"ip": client_ip, "cached": False}
|
| 1452 |
return detected_lang, detected_lang, query_state, *update_ui_lang(detected_lang).values()
|
| 1453 |
|
|
|
|
| 1049 |
""", visible=True)
|
| 1050 |
|
| 1051 |
with gr.Column(scale=0, min_width=160, elem_classes=["banner-lang-selector"]):
|
| 1052 |
+
# Lock UI to English only; allow_custom_value avoids Gradio errors if any non-en value is set programmatically
|
| 1053 |
lang_dropdown = gr.Dropdown(
|
| 1054 |
choices=[
|
| 1055 |
+
("English", "en"),
|
| 1056 |
],
|
| 1057 |
value="en",
|
| 1058 |
label="🌐",
|
| 1059 |
show_label=True,
|
| 1060 |
interactive=True,
|
| 1061 |
+
container=False,
|
| 1062 |
+
allow_custom_value=True,
|
| 1063 |
)
|
| 1064 |
|
| 1065 |
with gr.Tabs() as tabs:
|
|
|
|
| 1380 |
}
|
| 1381 |
|
| 1382 |
def on_lang_change(lang):
|
| 1383 |
+
# Force UI to stay in English regardless of dropdown value
|
| 1384 |
+
return "en", *update_ui_lang("en").values()
|
| 1385 |
|
| 1386 |
lang_dropdown.change(
|
| 1387 |
on_lang_change,
|
|
|
|
| 1433 |
try:
|
| 1434 |
# Check if IP is already cached (second+ visit)
|
| 1435 |
if client_ip in IP_Country_Cache:
|
| 1436 |
+
# Use cached data - but force English UI
|
| 1437 |
+
cached_lang = "en"
|
| 1438 |
+
print(f"Using cached language (forced to en) for IP: {client_ip}")
|
| 1439 |
+
query_state = {"ip": client_ip, "cached": True}
|
| 1440 |
+
return cached_lang, cached_lang, query_state, *update_ui_lang(cached_lang).values()
|
|
|
|
|
|
|
| 1441 |
|
| 1442 |
# First visit: Query IP and determine language (max 3s timeout built-in)
|
| 1443 |
print(f"First visit - detecting language for IP: {client_ip}")
|
| 1444 |
+
# Always force English UI even if detection yields another language
|
| 1445 |
+
detected_lang = "en"
|
| 1446 |
|
| 1447 |
+
print(f"First visit - Final language forced to: {detected_lang} for IP: {client_ip}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1448 |
query_state = {"ip": client_ip, "cached": False}
|
| 1449 |
return detected_lang, detected_lang, query_state, *update_ui_lang(detected_lang).values()
|
| 1450 |
|
__lib__/i18n/ar.pyc
CHANGED
|
Binary files a/__lib__/i18n/ar.pyc and b/__lib__/i18n/ar.pyc differ
|
|
|
__lib__/i18n/da.pyc
CHANGED
|
Binary files a/__lib__/i18n/da.pyc and b/__lib__/i18n/da.pyc differ
|
|
|
__lib__/i18n/de.pyc
CHANGED
|
Binary files a/__lib__/i18n/de.pyc and b/__lib__/i18n/de.pyc differ
|
|
|
__lib__/i18n/en.pyc
CHANGED
|
Binary files a/__lib__/i18n/en.pyc and b/__lib__/i18n/en.pyc differ
|
|
|
__lib__/i18n/es.pyc
CHANGED
|
Binary files a/__lib__/i18n/es.pyc and b/__lib__/i18n/es.pyc differ
|
|
|
__lib__/i18n/fi.pyc
CHANGED
|
Binary files a/__lib__/i18n/fi.pyc and b/__lib__/i18n/fi.pyc differ
|
|
|
__lib__/i18n/fr.pyc
CHANGED
|
Binary files a/__lib__/i18n/fr.pyc and b/__lib__/i18n/fr.pyc differ
|
|
|
__lib__/i18n/he.pyc
CHANGED
|
Binary files a/__lib__/i18n/he.pyc and b/__lib__/i18n/he.pyc differ
|
|
|
__lib__/i18n/hi.pyc
CHANGED
|
Binary files a/__lib__/i18n/hi.pyc and b/__lib__/i18n/hi.pyc differ
|
|
|
__lib__/i18n/id.pyc
CHANGED
|
Binary files a/__lib__/i18n/id.pyc and b/__lib__/i18n/id.pyc differ
|
|
|
__lib__/i18n/it.pyc
CHANGED
|
Binary files a/__lib__/i18n/it.pyc and b/__lib__/i18n/it.pyc differ
|
|
|
__lib__/i18n/ja.pyc
CHANGED
|
Binary files a/__lib__/i18n/ja.pyc and b/__lib__/i18n/ja.pyc differ
|
|
|
__lib__/i18n/nl.pyc
CHANGED
|
Binary files a/__lib__/i18n/nl.pyc and b/__lib__/i18n/nl.pyc differ
|
|
|
__lib__/i18n/no.pyc
CHANGED
|
Binary files a/__lib__/i18n/no.pyc and b/__lib__/i18n/no.pyc differ
|
|
|
__lib__/i18n/pt.pyc
CHANGED
|
Binary files a/__lib__/i18n/pt.pyc and b/__lib__/i18n/pt.pyc differ
|
|
|
__lib__/i18n/ru.pyc
CHANGED
|
Binary files a/__lib__/i18n/ru.pyc and b/__lib__/i18n/ru.pyc differ
|
|
|
__lib__/i18n/sv.pyc
CHANGED
|
Binary files a/__lib__/i18n/sv.pyc and b/__lib__/i18n/sv.pyc differ
|
|
|
__lib__/i18n/tr.pyc
CHANGED
|
Binary files a/__lib__/i18n/tr.pyc and b/__lib__/i18n/tr.pyc differ
|
|
|
__lib__/i18n/uk.pyc
CHANGED
|
Binary files a/__lib__/i18n/uk.pyc and b/__lib__/i18n/uk.pyc differ
|
|
|
__lib__/i18n/vi.pyc
CHANGED
|
Binary files a/__lib__/i18n/vi.pyc and b/__lib__/i18n/vi.pyc differ
|
|
|
__lib__/i18n/zh.pyc
CHANGED
|
Binary files a/__lib__/i18n/zh.pyc and b/__lib__/i18n/zh.pyc differ
|
|
|