Alejandro Cremades commited on
Commit
5dbcf27
·
1 Parent(s): 59718b5

Localize list check page

Browse files
Middle_School_Card_Search.py CHANGED
@@ -9,7 +9,7 @@ number_shown_results = 20
9
  _ = streamlit_common.locale.get_locale()
10
 
11
  st.set_page_config(
12
- page_title="Middle School | Card Search",
13
  page_icon="🃏",
14
  layout="wide",
15
  )
 
9
  _ = streamlit_common.locale.get_locale()
10
 
11
  st.set_page_config(
12
+ page_title="MTG Middle School | Card Search",
13
  page_icon="🃏",
14
  layout="wide",
15
  )
pages/1_Check_Card_List.py CHANGED
@@ -2,21 +2,23 @@ import streamlit as st
2
  import pandas as pd
3
  import streamlit_common.footer
4
  import streamlit_common.lib as lib
 
5
 
6
  mslist_path = "output/middleschool.csv"
 
7
 
8
  st.set_page_config(
9
- page_title="Middle School | Check Card List",
10
  page_icon="🃏",
11
  layout="wide",
12
  )
13
- st.write(
14
- """
15
- # Middle School List Check
16
-
17
- Paste or type your list here to confirm that every card in it is Middle School legal.
18
- """
19
  )
 
 
20
 
21
  mslist_df = pd.read_csv(mslist_path)
22
  mslist_df.fillna("", inplace=True)
@@ -24,7 +26,9 @@ mslist_df.fillna("", inplace=True)
24
  col1, col2 = st.columns(2)
25
 
26
  input_list = col1.text_area(
27
- label="##### Card list", placeholder="4 Lightning Bolt\n4 ボール・ライトニング", height=400
 
 
28
  )
29
 
30
  cardnames = []
@@ -47,7 +51,9 @@ illegal_cards = 0
47
  if input_cards.shape[0] > 0:
48
  illegal_cards = input_cards[input_cards["Legal"] != "✅"].shape[0]
49
 
50
- col2.write(f"##### This list has {illegal_cards} illegal cards")
 
 
51
  if "English" in input_cards and "日本語" in input_cards:
52
  col2.dataframe(
53
  input_cards[["Legal", "English", "日本語"]],
 
2
  import pandas as pd
3
  import streamlit_common.footer
4
  import streamlit_common.lib as lib
5
+ import streamlit_common.locale
6
 
7
  mslist_path = "output/middleschool.csv"
8
+ _ = streamlit_common.locale.get_locale()
9
 
10
  st.set_page_config(
11
+ page_title="MTG Middle School | Check Card List",
12
  page_icon="🃏",
13
  layout="wide",
14
  )
15
+ l = st.sidebar.radio(
16
+ label="luage / 言語",
17
+ options=["en", "ja"],
18
+ captions=["English", "日本語"],
 
 
19
  )
20
+ st.write(f'# {_["check"]["title"][l]}')
21
+ st.write(_["check"]["instructions"][l])
22
 
23
  mslist_df = pd.read_csv(mslist_path)
24
  mslist_df.fillna("", inplace=True)
 
26
  col1, col2 = st.columns(2)
27
 
28
  input_list = col1.text_area(
29
+ label=f'##### {_["check"]["card_list"][l]}',
30
+ placeholder="4 Lightning Bolt\n4 ボール・ライトニング",
31
+ height=400,
32
  )
33
 
34
  cardnames = []
 
51
  if input_cards.shape[0] > 0:
52
  illegal_cards = input_cards[input_cards["Legal"] != "✅"].shape[0]
53
 
54
+ col2.write(
55
+ f'##### {_["check"]["illegal_cards_1"][l]}{illegal_cards}{_["check"]["illegal_cards_2"][l]}'
56
+ )
57
  if "English" in input_cards and "日本語" in input_cards:
58
  col2.dataframe(
59
  input_cards[["Legal", "English", "日本語"]],
streamlit_common/locale.py CHANGED
@@ -1,7 +1,7 @@
1
  def get_locale():
2
  return {
3
  "search": {
4
- "title": {"en": "Middle School Card Search", "ja": "ミドルスクール カード検索"},
5
  "instructions": {
6
  "en": "Enter any English or Japanese text to find all [Middle School legal](https://www.eternalcentral.com/middleschoolrules/) card titles which include it.",
7
  "ja": "カードの英語名か日本語名を入力し始めると[ミドルスクールで使用可能](https://www.eternalcentral.com/middleschoolrules/)なカード名が引っかかります。",
@@ -27,4 +27,26 @@ def get_locale():
27
  "ja": "上位の検索結果:",
28
  },
29
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
 
1
  def get_locale():
2
  return {
3
  "search": {
4
+ "title": {"en": "MTG Middle School Card Search", "ja": "MTG ミドルスクール カード検索"},
5
  "instructions": {
6
  "en": "Enter any English or Japanese text to find all [Middle School legal](https://www.eternalcentral.com/middleschoolrules/) card titles which include it.",
7
  "ja": "カードの英語名か日本語名を入力し始めると[ミドルスクールで使用可能](https://www.eternalcentral.com/middleschoolrules/)なカード名が引っかかります。",
 
27
  "ja": "上位の検索結果:",
28
  },
29
  },
30
+ "check": {
31
+ "title": {
32
+ "en": "MTG Middle School List Check",
33
+ "ja": "MTG ミドルスクール リストチェック",
34
+ },
35
+ "instructions": {
36
+ "en": "Paste or type your list here to confirm that every card in it is [Middle School legal](https://www.eternalcentral.com/middleschoolrules/).",
37
+ "ja": "[ミドルスクールで使用可能](https://www.eternalcentral.com/middleschoolrules/)かどうかを確認するには、ここにリストを貼り付けたり入力したりしてください。",
38
+ },
39
+ "card_list": {
40
+ "en": "Card list",
41
+ "ja": "カードリスト",
42
+ },
43
+ "illegal_cards_1": {
44
+ "en": "**",
45
+ "ja": "使用不可カード **",
46
+ },
47
+ "illegal_cards_2": {
48
+ "en": "** illegal cards",
49
+ "ja": "**枚",
50
+ },
51
+ },
52
  }