From 862b742fbbdb4d95695a6cc555954300bbbc5239 Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Wed, 4 Nov 2020 13:50:18 +0100 Subject: [PATCH 01/30] Add fallback to each route Not sure if this causes any side effects --- src/App.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index a1396aaf..fc0d766a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -52,7 +52,9 @@ export const App = () => { {config.content?.pages.map((page, id) => ( - + + + ))} From 79fef3e71d25b6416220fc8b644f30e5915daa6a Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Wed, 4 Nov 2020 13:50:41 +0100 Subject: [PATCH 02/30] Move action texts for basic recommendations to translation file --- .../BasicRecommendations.tsx | 54 ++++++++++++------- .../static/locales/de/translation.json | 35 +++++++++++- apps/official/static/texts/ActionTexts.ts | 20 ------- 3 files changed, 68 insertions(+), 41 deletions(-) delete mode 100644 apps/official/static/texts/ActionTexts.ts diff --git a/apps/official/components/basic-recommendations/BasicRecommendations.tsx b/apps/official/components/basic-recommendations/BasicRecommendations.tsx index 33d45dde..b7e1588f 100644 --- a/apps/official/components/basic-recommendations/BasicRecommendations.tsx +++ b/apps/official/components/basic-recommendations/BasicRecommendations.tsx @@ -13,8 +13,8 @@ import HygieneIcon from "../../static/images/hand-washing.svg"; import MaskIcon from "../../static/images/mask.svg"; import VentilationIcon from "../../static/images/fresh-air.svg"; import RegionalIcon from "../../static/images/checklist.svg"; -import { ActionTexts } from "../../static/texts/ActionTexts"; import { NavigationTitle } from "app-config/components/NavigationTitle"; +import { useTranslation } from "react-i18next"; const useStyles = makeStyles({ teaser: { @@ -39,7 +39,7 @@ const useStyles = makeStyles({ const CountyTeaser = ({ county, url }: { county: string; url: string }): JSX.Element => { const classes = useStyles(); - const teaser = `${ActionTexts.COUNTY_TEASER_1}${county}${ActionTexts.COUNTY_TEASER_2}`; + const { t } = useTranslation("translation"); return ( @@ -119,7 +120,7 @@ export const WelcomeModalPostalCode: React.FC = () => { variant="contained" onClick={onSkip} > - Ohne Postleitzahl weiter + {t("welcome.regional-risk.continue-without-post-code")} diff --git a/src/components/WelcomeStepsModal/WelcomeStepsModal.tsx b/src/components/WelcomeStepsModal/WelcomeStepsModal.tsx index e4b93c13..159e52c5 100644 --- a/src/components/WelcomeStepsModal/WelcomeStepsModal.tsx +++ b/src/components/WelcomeStepsModal/WelcomeStepsModal.tsx @@ -9,6 +9,7 @@ import { State } from "../../state"; import { StepConfig, welcomeStepsConfig } from "./welcomeStepsConfig"; import { MobileDotsStepper } from "./MobileDotsStepper"; import { useCommonWelcomeModalStyles } from "./useCommonWelcomeModalStyles"; +import { useTranslation } from "react-i18next"; function getStepConfig(stepName?: string): StepConfig | undefined { return welcomeStepsConfig.find(({ name }) => name === stepName); @@ -19,6 +20,7 @@ export const WelcomeStepsModal: React.FC<{ subPage?: string }> = (props) => { const theme = useTheme(); const fullScreen = useMediaQuery(theme.breakpoints.down("sm")); const history = useHistory(); + const { t } = useTranslation("common"); const userPostalCode = useSelector((state: State) => state.app.userPostalCode); @@ -38,7 +40,7 @@ export const WelcomeStepsModal: React.FC<{ subPage?: string }> = (props) => { component={Link} to={currentStepConfig.next} > - Weiter + {t("welcome.continue")} ) : null; @@ -52,7 +54,7 @@ export const WelcomeStepsModal: React.FC<{ subPage?: string }> = (props) => { component={Link} to={currentStepConfig.skip} > - Überspringen + {t("welcome.skip")} ) : null; diff --git a/static/locales/de/common.json b/static/locales/de/common.json index 88c2299e..1cd6c0cc 100644 --- a/static/locales/de/common.json +++ b/static/locales/de/common.json @@ -12,5 +12,32 @@ "share-button-twitter": "Auf Twitter teilen", "share-description-error-details": "Klicke hier für Fehlerdetails" }, - "no data for selected timeframe": "Keine Daten für den ausgewählten Zeitraum." -} + "no data for selected timeframe": "Keine Daten für den ausgewählten Zeitraum.", + "welcome": { + "title": "Willkommen bei der CovMap", + "info-1": "Entwickelt von Ärzten der Charité - Universitätsmedizin Berlin", + "info-2": "Regionale Risikoeinschätzung zum Coronavirus", + "info-3": "Informationen zu allgemeinen Schutzmaßnahmen", + "info-4": "Links zu aktuellen Verhaltensregeln aller Landkreise", + "what-is-it": { + "title": "Was ist die CovMap?", + "text": "Die CovMap möchte Risikogebiete so zeitnah wie möglich erkennen. Dazu ziehen wir die offiziellen Fallzahlen, sowie ein von uns entwickeltes Vorhersagemodell basierend auf Kontakten und Symptomen heran." + }, + "what-does-it-show": { + "title": "Was zeigt mir die CovMap an?", + "text": "Auf der Karte kannst du ganz einfach erkennen, wo sich momentane Risikogebiete in Deutschland und in Deiner Region befinden.", + "normal-risk": "Grün = normales Risiko", + "medium-risk": "Orange = mittleres Risiko", + "high-risk": "Rot = hohes Risiko" + }, + "regional-risk": { + "title": "Für Dein regionales Risiko brauchen wir noch die Postleitzahl Deines Wohnortes", + "invalid-post-code": "Bitte valide PLZ eingeben", + "accept-privacy": "Ja, ich habe die <1>Datenschutzerklärung zur Kenntnis genommen und willige ein.", + "start": "Jetzt starten", + "continue-without-post-code": "Ohne Postleitzahl weiter" + }, + "continue": "Weiter", + "skip": "Überspringen" + } +} \ No newline at end of file From 813262c35798cc1f8a2a2725ae2942c2d82f22b8 Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Fri, 6 Nov 2020 18:42:57 +0100 Subject: [PATCH 25/30] Move texts for install promt to common translation file --- src/components/InstallPrompt.tsx | 10 ++++++---- static/locales/de/common.json | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/InstallPrompt.tsx b/src/components/InstallPrompt.tsx index 2acde6ad..ea33a16b 100644 --- a/src/components/InstallPrompt.tsx +++ b/src/components/InstallPrompt.tsx @@ -6,6 +6,7 @@ import { useThunkDispatch } from "src/useThunkDispatch"; import { useSelector } from "react-redux"; import { State } from "../state"; import { triggerInstallPrompt } from "../state/thunks/triggerInstallPrompt"; +import { useTranslation } from "react-i18next"; const useStyles = makeStyles((theme) => ({ root: { @@ -32,6 +33,7 @@ type NoThanksState = boolean; export const InstallPrompt = ({ shouldShow }: InstallPromptProps) => { const dispatch = useThunkDispatch(); + const { t } = useTranslation("common"); const prompt = useSelector((state: State) => state.app.installPrompt); const installed = useSelector((state: State) => state.app.isInstalled); const [noThanks, setNoThanks] = useState(() => false); @@ -59,18 +61,18 @@ export const InstallPrompt = ({ shouldShow }: InstallPromptProps) => { const dialog = (
-

Diese App kann auf deinem Geraet installiert werden.

-

Tappe den Button unten um dich zu entscheiden!

+

{t("install-promt.text-1")}

+

{t("install-promt.text-2")}

); diff --git a/static/locales/de/common.json b/static/locales/de/common.json index 1cd6c0cc..0a21953b 100644 --- a/static/locales/de/common.json +++ b/static/locales/de/common.json @@ -39,5 +39,11 @@ }, "continue": "Weiter", "skip": "Überspringen" + }, + "install-promt": { + "text-1": "Diese App kann auf deinem Geraet installiert werden.", + "text-2": "Tappe den Button unten um dich zu entscheiden!", + "confirm": "Alles klar!", + "cancel": "Nee danke." } } \ No newline at end of file From 55a95b6dc896a345591f9e8b120225ca3f354c3e Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Fri, 6 Nov 2020 18:45:01 +0100 Subject: [PATCH 26/30] Move texts for lazy error to common translation file --- src/components/LazyError.tsx | 4 +++- static/locales/de/common.json | 3 ++- static/locales/en/common.json | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/LazyError.tsx b/src/components/LazyError.tsx index 26641bed..d250ecc5 100644 --- a/src/components/LazyError.tsx +++ b/src/components/LazyError.tsx @@ -1,14 +1,16 @@ import { useEffect } from "react"; +import { useTranslation } from "react-i18next"; import { AppApi } from "src/state/app"; import { useThunkDispatch } from "src/useThunkDispatch"; export const LazyError = () => { const dispatch = useThunkDispatch(); + const { t } = useTranslation("common"); useEffect(() => { dispatch( AppApi.setSnackbarMessage({ - text: "Check you network connection and refresh the app/page.", + text: t("lazy-error"), type: "error", duration: 30000, }), diff --git a/static/locales/de/common.json b/static/locales/de/common.json index 0a21953b..fbefb901 100644 --- a/static/locales/de/common.json +++ b/static/locales/de/common.json @@ -45,5 +45,6 @@ "text-2": "Tappe den Button unten um dich zu entscheiden!", "confirm": "Alles klar!", "cancel": "Nee danke." - } + }, + "lazy-error": "Überprüfe Deine Netzwerkverbindung und aktualisiere die App." } \ No newline at end of file diff --git a/static/locales/en/common.json b/static/locales/en/common.json index 15b46189..68dd67aa 100644 --- a/static/locales/en/common.json +++ b/static/locales/en/common.json @@ -12,5 +12,6 @@ "share-button-twitter": "Share on Twitter", "share-description-error-details": "Click for error details" }, - "no data for selected timeframe": "No data available for the selected date." + "no data for selected timeframe": "No data available for the selected date.", + "lazy-error": "Check you network connection and refresh the app/page." } From 8820581b1632953d6f4cb9971acc6428697aefce Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Fri, 6 Nov 2020 18:47:28 +0100 Subject: [PATCH 27/30] Move text for copying to clipboard to common translation file --- src/components/NavBar.tsx | 2 +- static/locales/de/common.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index 39524f69..1a408996 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -141,7 +141,7 @@ export const NavBar = () => { }); } catch (err) { clipboard.writeText("https://" + window.location.hostname); - dispatch(AppApi.setSnackbarMessage({ text: "Link in Zwischenablage kopiert", type: "info" })); + dispatch(AppApi.setSnackbarMessage({ text: t("common:copied-to-clipboard"), type: "info" })); } }; diff --git a/static/locales/de/common.json b/static/locales/de/common.json index fbefb901..de852f48 100644 --- a/static/locales/de/common.json +++ b/static/locales/de/common.json @@ -46,5 +46,6 @@ "confirm": "Alles klar!", "cancel": "Nee danke." }, - "lazy-error": "Überprüfe Deine Netzwerkverbindung und aktualisiere die App." + "lazy-error": "Überprüfe Deine Netzwerkverbindung und aktualisiere die App.", + "copied-to-clipboard": "Link in Zwischenablage kopiert" } \ No newline at end of file From 3dd9601063c116e5ba8249eb8b66677bf3405b41 Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Fri, 6 Nov 2020 18:53:55 +0100 Subject: [PATCH 28/30] Move texts for welcome info to common translation file --- src/components/WelcomeInfo.tsx | 4 +++- static/locales/de/common.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/WelcomeInfo.tsx b/src/components/WelcomeInfo.tsx index 787eb0b1..67de5ff9 100644 --- a/src/components/WelcomeInfo.tsx +++ b/src/components/WelcomeInfo.tsx @@ -8,9 +8,11 @@ import { AppApi } from "../state/app"; import { State } from "../state"; import { useThunkDispatch } from "../useThunkDispatch"; import { config } from "app-config/index"; +import { useTranslation } from "react-i18next"; export const WelcomeInfo = () => { const dispatch = useThunkDispatch(); + const { t } = useTranslation("common"); const currentVisual = useSelector((state: State) => state.app.currentVisual); const infoDialogs = useSelector((state: State) => state.app.infoDialogs); const InfoComponent = config.visuals[currentVisual].InfoComponent; @@ -32,7 +34,7 @@ export const WelcomeInfo = () => { {InfoComponent && } diff --git a/static/locales/de/common.json b/static/locales/de/common.json index de852f48..a9efd23c 100644 --- a/static/locales/de/common.json +++ b/static/locales/de/common.json @@ -47,5 +47,6 @@ "cancel": "Nee danke." }, "lazy-error": "Überprüfe Deine Netzwerkverbindung und aktualisiere die App.", - "copied-to-clipboard": "Link in Zwischenablage kopiert" + "copied-to-clipboard": "Link in Zwischenablage kopiert", + "close": "Schließen" } \ No newline at end of file From 25f6723a24b01ed8287eb0491bde3dafa62d2f52 Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Fri, 6 Nov 2020 18:54:36 +0100 Subject: [PATCH 29/30] Run prettier --- static/locales/de/common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/locales/de/common.json b/static/locales/de/common.json index a9efd23c..c95b8a95 100644 --- a/static/locales/de/common.json +++ b/static/locales/de/common.json @@ -49,4 +49,4 @@ "lazy-error": "Überprüfe Deine Netzwerkverbindung und aktualisiere die App.", "copied-to-clipboard": "Link in Zwischenablage kopiert", "close": "Schließen" -} \ No newline at end of file +} From 8a68757570b3d946ca104e1b0d703fccf5a174c2 Mon Sep 17 00:00:00 2001 From: Janna Wieneke Date: Fri, 6 Nov 2020 19:57:35 +0100 Subject: [PATCH 30/30] Add suspense with fallback to installPromt --- src/App.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index fc0d766a..129276a2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -41,7 +41,9 @@ export const App = () => { - + + +