From 153a6df4a24517d450bb800d3ee5c8dc351c77d1 Mon Sep 17 00:00:00 2001 From: Filip Czaplicki Date: Sat, 23 Dec 2023 14:39:06 +0100 Subject: [PATCH] Provide default en for undefined resolvedLanguage --- src/components/downloadCard.tsx | 3 ++- src/components/languageSwitcher.tsx | 2 +- src/components/map.tsx | 5 +++-- src/components/navbar.tsx | 5 +++-- src/components/sidebar/defibrillatorEditor.tsx | 9 +++++---- src/components/sidebar/openingHours.tsx | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/components/downloadCard.tsx b/src/components/downloadCard.tsx index 3210acf..14c2e82 100644 --- a/src/components/downloadCard.tsx +++ b/src/components/downloadCard.tsx @@ -8,7 +8,8 @@ import { backendBaseUrl, fetchCountriesData } from "../backend"; const worldCountryCode = "WORLD"; export default function DownloadCard() { - const { t, i18n: { resolvedLanguage: language } } = useTranslation(); + const { t, i18n: { resolvedLanguage } } = useTranslation(); + const language = resolvedLanguage ?? "en"; function countryName(country: Country) { if (country.code === worldCountryCode) return t("sidebar.world"); const backendLanguageUppercase = language.toUpperCase(); diff --git a/src/components/languageSwitcher.tsx b/src/components/languageSwitcher.tsx index e60a3ae..a4091c3 100644 --- a/src/components/languageSwitcher.tsx +++ b/src/components/languageSwitcher.tsx @@ -9,7 +9,7 @@ export default function LanguageSwitcher() {