Spaces:
Running
Running
Alejandro Cremades
commited on
Commit
·
14ce0f4
1
Parent(s):
c955f0a
Localize card type select box options to Japanese
Browse files- Middle_School_Card_Search.py +6 -2
- streamlit_common/locale.py +46 -0
Middle_School_Card_Search.py
CHANGED
@@ -71,12 +71,16 @@ if colorcol6.checkbox(_["basic"]["color_c"][l]):
|
|
71 |
|
72 |
col1, col2 = st.columns(2)
|
73 |
# Filter by type (select)
|
|
|
74 |
select_types = col1.multiselect(
|
75 |
_["search"]["select_type"][l],
|
76 |
-
[
|
77 |
)
|
78 |
for cardtype in select_types:
|
79 |
-
|
|
|
|
|
|
|
80 |
|
81 |
# Filter by type (text input)
|
82 |
input_type = col2.text_input(_["search"]["search_by_type"][l]).strip()
|
|
|
71 |
|
72 |
col1, col2 = st.columns(2)
|
73 |
# Filter by type (select)
|
74 |
+
type_list = streamlit_common.locale.get_type_options()
|
75 |
select_types = col1.multiselect(
|
76 |
_["search"]["select_type"][l],
|
77 |
+
type_list[l],
|
78 |
)
|
79 |
for cardtype in select_types:
|
80 |
+
type_to_search = cardtype
|
81 |
+
if l == "ja":
|
82 |
+
type_to_search = type_list["en"][type_list["ja"].index(cardtype)]
|
83 |
+
results_df = results_df[results_df["type"].str.contains(type_to_search, case=False)]
|
84 |
|
85 |
# Filter by type (text input)
|
86 |
input_type = col2.text_input(_["search"]["search_by_type"][l]).strip()
|
streamlit_common/locale.py
CHANGED
@@ -98,5 +98,51 @@ def get_locale():
|
|
98 |
"en": "C",
|
99 |
"ja": "無/茶",
|
100 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
},
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
"en": "C",
|
99 |
"ja": "無/茶",
|
100 |
},
|
101 |
+
"type_artifact": {
|
102 |
+
"en": "Artifact",
|
103 |
+
"ja": "アーティファクト",
|
104 |
+
},
|
105 |
+
"type_creature": {
|
106 |
+
"en": "Creature",
|
107 |
+
"ja": "クリーチャー",
|
108 |
+
},
|
109 |
+
"type_enchantment": {
|
110 |
+
"en": "Enchantment",
|
111 |
+
"ja": "エンチャント",
|
112 |
+
},
|
113 |
+
"type_instant": {
|
114 |
+
"en": "Instant",
|
115 |
+
"ja": "インスタント",
|
116 |
+
},
|
117 |
+
"type_land": {
|
118 |
+
"en": "Land",
|
119 |
+
"ja": "土地",
|
120 |
+
},
|
121 |
+
"type_sorcery": {
|
122 |
+
"en": "Sorcery",
|
123 |
+
"ja": "ソーサリー",
|
124 |
+
},
|
125 |
},
|
126 |
}
|
127 |
+
|
128 |
+
|
129 |
+
def get_type_options():
|
130 |
+
_ = get_locale()
|
131 |
+
return {
|
132 |
+
"en": [
|
133 |
+
_["basic"]["type_artifact"]["en"],
|
134 |
+
_["basic"]["type_creature"]["en"],
|
135 |
+
_["basic"]["type_enchantment"]["en"],
|
136 |
+
_["basic"]["type_instant"]["en"],
|
137 |
+
_["basic"]["type_land"]["en"],
|
138 |
+
_["basic"]["type_sorcery"]["en"],
|
139 |
+
],
|
140 |
+
"ja": [
|
141 |
+
_["basic"]["type_artifact"]["ja"],
|
142 |
+
_["basic"]["type_creature"]["ja"],
|
143 |
+
_["basic"]["type_enchantment"]["ja"],
|
144 |
+
_["basic"]["type_instant"]["ja"],
|
145 |
+
_["basic"]["type_land"]["ja"],
|
146 |
+
_["basic"]["type_sorcery"]["ja"],
|
147 |
+
],
|
148 |
+
}
|