Spaces:
Sleeping
Sleeping
Using urllib to parse/quote.
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import langcodes
|
| 3 |
from requests_html import HTMLSession
|
|
|
|
|
|
|
| 4 |
|
| 5 |
st.write("# Language code/tag search")
|
| 6 |
st.write("Fed up with language tag confusion? Here's your one-stop shop!")
|
|
@@ -39,8 +41,8 @@ if lang is None:
|
|
| 39 |
except LookupError as e:
|
| 40 |
st.write("## Result: failure!")
|
| 41 |
st.write(f"Unable to look up language code. But all hope is not lost...")
|
| 42 |
-
st.write(f"* You can also try https://r12a.github.io/app-subtags/")
|
| 43 |
-
st.write(f"* Or possibly https://glottolog.org/glottolog?search={langtext}")
|
| 44 |
lang = None
|
| 45 |
|
| 46 |
|
|
@@ -78,8 +80,9 @@ if lang is not None:
|
|
| 78 |
|
| 79 |
st.write(f"Broader tags for this language, if any:")
|
| 80 |
st.write(broader_tags)
|
| 81 |
-
st.write(f"Try also: https://r12a.github.io/app-subtags/?lookup={lang}, which will likely have links to Ethnologue, Wikipedia, and Character usage.")
|
| 82 |
-
st.write(f"https://glottolog.org/glottolog?search={t_variant} may be also of interest, with links to various resources including WALS, Wikidata, Odin, and OLAC. If that doesn't work, try https://glottolog.org/glottolog?search={b_variant}, or put in a [custom search query](https://glottolog.org/glottolog)")
|
|
|
|
| 83 |
|
| 84 |
# ethnologue prefers T for german (deu), and T for French
|
| 85 |
st.write("## Older Codes")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import langcodes
|
| 3 |
from requests_html import HTMLSession
|
| 4 |
+
import urllib
|
| 5 |
+
|
| 6 |
|
| 7 |
st.write("# Language code/tag search")
|
| 8 |
st.write("Fed up with language tag confusion? Here's your one-stop shop!")
|
|
|
|
| 41 |
except LookupError as e:
|
| 42 |
st.write("## Result: failure!")
|
| 43 |
st.write(f"Unable to look up language code. But all hope is not lost...")
|
| 44 |
+
st.write(f"* You can also try https://r12a.github.io/app-subtags/")
|
| 45 |
+
st.write(f"* Or possibly https://glottolog.org/glottolog?search={urllib.parse.quote(langtext)}")
|
| 46 |
lang = None
|
| 47 |
|
| 48 |
|
|
|
|
| 80 |
|
| 81 |
st.write(f"Broader tags for this language, if any:")
|
| 82 |
st.write(broader_tags)
|
| 83 |
+
st.write(f"Try also: https://r12a.github.io/app-subtags/?lookup={lang}, which will likely have links to Ethnologue, Wikipedia, and Character usage, or alternately [searching for the original string {langtext}](https://r12a.github.io/app-subtags/?find={langtext}")
|
| 84 |
+
st.write(f"https://glottolog.org/glottolog?search={t_variant} may be also of interest, with links to various resources including WALS, Wikidata, Odin, and OLAC. If that doesn't work, try https://glottolog.org/glottolog?search={b_variant}, or put in a [custom search query](https://glottolog.org/glottolog)")
|
| 85 |
+
st.write(f"https://glottolog.org/glottolog?search={urllib.parse.quote(langtext)} may pull up something as well. "
|
| 86 |
|
| 87 |
# ethnologue prefers T for german (deu), and T for French
|
| 88 |
st.write("## Older Codes")
|