Skip to content

Commit 75e5d1e

Browse files
Merge branch 'develop' into log-scale
2 parents ee38e78 + 45aeb49 commit 75e5d1e

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

docs/contributing/app-dev.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ STREAMLIT_SERVER_PORT=1234 \
8585
PARAMETERS=./defaults/webapp.cfg streamlit run st_app.py
8686
```
8787

88+
### Choosing a Different Language
89+
90+
If you want to run the application in another language, do the following. You can select Japanese as the language other than English.
91+
92+
```bash
93+
ASSETS=./defaults/assets \
94+
LANG=ja \
95+
PARAMETERS=./defaults/webapp.cfg streamlit run st_app.py
96+
```
97+
8898
## Project Layout
8999

90100
### Application files

src/penn_chime/locales/en.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ en:
44
app-admitted-patients-title: "Admitted Patients (Census)"
55
app-admitted-patients-text: "Projected **census** of COVID-19 patients, accounting for arrivals and discharges."
66
app-PPE-title: "Personal Protective Equipment (PPE) Calculator"
7+
app-PPE-screenshot: "Show a screenshot of the tool"
8+
app-PPE-documentation: |+
9+
Refer to our <a href="{link_to_docs}">user documentation for instructions on how to use the tool</a>.
710
app-SIR-title: "Susceptible, Infected, and Recovered"
811
app-SIR-text: "The number of susceptible, infected, and recovered individuals in the hospital catchment region at any given moment"
912
charts-date: "Date"
@@ -82,6 +85,8 @@ en:
8285
presentation-copyright: "© 2020, The Trustees of the University of Pennsylvania"
8386
presentation-download: |+
8487
<a download="{filename}" href="data:file/csv;base64,{csv}">Download {filename}</a>
88+
presentation-excel-download: |+
89+
Download the PPE Calculator here: <a download="{filename}" href="data:file/xlsx;base64,{excel}">{filename}</a>.
8590
admits_hospitalized: "Hospitalized Admissions"
8691
admits_icu: "ICU Admissions"
8792
admits_ventilated: "Ventilated Admissions"

src/penn_chime/locales/ja.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ ja:
33
app-new-admissions-text: "**日毎の**COVID-19関連新規入院患者数予測"
44
app-admitted-patients-title: "累計入院患者数"
55
app-admitted-patients-text: "入院と退院を考慮したCOVID-19患者の予測**累計患者数**"
6+
app-PPE-title: "個人用防護具 (PPE) 計算機"
7+
app-PPE-screenshot: "ツールのスクリーンショットを表示"
8+
app-PPE-documentation: |+
9+
ツールの使い方については<a href="{link_to_docs}">ユーザドキュメントの説明</a>を確認してください。
610
app-SIR-title: "感受性保持者、感染者と回復者"
711
app-SIR-text: "与えられた時間範囲での、病院の担当範囲領域における感受性保持者、感染者と回復者の人数"
812
charts-date: "日付"
@@ -79,6 +83,8 @@ ja:
7983
presentation-copyright: "© 2020, The Trustees of the University of Pennsylvania"
8084
presentation-download: |+
8185
<a download="{filename}" href="data:file/csv;base64,{csv}">{filename} をダウンロード</a>
86+
presentation-excel-download: |+
87+
個人用防護具計算機のダウンロードはこちら: <a download="{filename}" href="data:file/xlsx;base64,{excel}">{filename}</a>.
8288
admits_hospitalized: "新規入院患者数"
8389
admits_icu: "新規集中治療患者数"
8490
admits_ventilated: "新規人工呼吸患者数"

src/penn_chime/view/st_app.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import streamlit as st
77
import i18n
88

9+
lang = os.environ.get('LANG') or 'en'
910
i18n.set('filename_format', '{locale}.{format}')
10-
i18n.set('locale', 'en')
11+
i18n.set('locale', lang)
1112
i18n.set('fallback', 'en')
1213
i18n.load_path.append(os.path.dirname(__file__) + '/../locales')
1314

@@ -27,7 +28,9 @@
2728
display_sidebar,
2829
hide_menu_style,
2930
)
30-
31+
from ..constants import (
32+
DOCS_URL,
33+
)
3134

3235
def main():
3336
# This is somewhat dangerous:
@@ -77,16 +80,15 @@ def main():
7780
df=m.ppe_df,
7881
)
7982

80-
if st.checkbox("Show a screenshot of the tool"):
83+
if st.checkbox(i18n.t("app-PPE-screenshot")):
8184
st.image(
8285
image=ppe.screenshot,
8386
width=600,
8487
format='JPEG',
8588
)
86-
st.markdown("""
87-
Refer to our <a href="{link_to_docs}">user documentation for instructions on how to use the tool</a>.
88-
""".format(
89-
link_to_docs="https://code-for-philly.gitbook.io/chime/ppe-calculator",
89+
st.markdown(
90+
i18n.t("app-PPE-documentation").format(
91+
link_to_docs="{docs_url}/ppe-calculator".format(docs_url=DOCS_URL),
9092
),
9193
unsafe_allow_html=True
9294
)

src/penn_chime/view/st_display.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,8 @@ def display_download_link(st, p, filename: str, df: pd.DataFrame):
476476

477477
def display_excel_download_link(st, filename: str, src: str):
478478
excel = excel_to_base64(src)
479-
st.markdown("""
480-
Download the PPE Calculator here: <a download="{filename}" href="data:file/xlsx;base64,{excel}">{filename}</a>.
481-
""".format(
479+
st.markdown(
480+
i18n.t("presentation-excel-download").format(
482481
excel=excel, filename=filename
483482
),
484483
unsafe_allow_html=True,

0 commit comments

Comments
 (0)