From 3db9234d75ce656b3063f2442c6a6a6015b39544 Mon Sep 17 00:00:00 2001 From: Manuel Brandstetter <36969812+brandstetterm@users.noreply.github.com> Date: Wed, 3 Apr 2024 19:40:18 +0200 Subject: [PATCH] improvement: show default language on index path (remove `/en` path) (#197) --- src/components/Footer/Footer.astro | 21 +++++++++++---------- src/components/Navbar/Navbar.astro | 15 ++++++++------- src/components/UserMenu/UserMenu.tsx | 2 +- src/i18n/utils.ts | 17 +++++++++++++++++ src/layouts/Layout.astro | 8 +++++--- src/layouts/LegalLayout.astro | 15 ++++++++------- src/pages/[lang]/cookie-policy.astro | 20 -------------------- src/pages/[lang]/data-protection.astro | 21 --------------------- src/pages/[lang]/legal-notice.astro | 20 -------------------- src/pages/[lang]/terms.astro | 26 -------------------------- src/pages/cookie-policy.astro | 11 +++++++++++ src/pages/data-protection.astro | 12 ++++++++++++ src/pages/de/cookie-policy.astro | 11 +++++++++++ src/pages/de/data-protection.astro | 12 ++++++++++++ src/pages/{[lang] => de}/index.astro | 8 ++------ src/pages/de/legal-notice.astro | 11 +++++++++++ src/pages/de/terms.astro | 17 +++++++++++++++++ src/pages/en/cookie-policy.astro | 4 ++++ src/pages/en/data-protection.astro | 4 ++++ src/pages/en/index.astro | 4 ++++ src/pages/en/legal-notice.astro | 4 ++++ src/pages/en/terms.astro | 4 ++++ src/pages/index.astro | 20 +++++++++++++++++++- src/pages/legal-notice.astro | 11 +++++++++++ src/pages/terms.astro | 17 +++++++++++++++++ src/views/AboutUs/AboutUs.astro | 5 +++-- src/views/Choices/Choices.astro | 5 +++-- src/views/Features/Features.astro | 5 +++-- src/views/Feedback/Feedback.astro | 5 +++-- src/views/Hero/Hero.astro | 5 +++-- src/views/Mobile/Mobile.astro | 7 ++++--- src/views/TargetUser/TargetUser.astro | 7 ++++--- src/views/Uniqueness/Uniqueness.astro | 7 ++++--- 33 files changed, 220 insertions(+), 141 deletions(-) create mode 100644 src/i18n/utils.ts delete mode 100644 src/pages/[lang]/cookie-policy.astro delete mode 100644 src/pages/[lang]/data-protection.astro delete mode 100644 src/pages/[lang]/legal-notice.astro delete mode 100644 src/pages/[lang]/terms.astro create mode 100644 src/pages/cookie-policy.astro create mode 100644 src/pages/data-protection.astro create mode 100644 src/pages/de/cookie-policy.astro create mode 100644 src/pages/de/data-protection.astro rename src/pages/{[lang] => de}/index.astro (71%) create mode 100644 src/pages/de/legal-notice.astro create mode 100644 src/pages/de/terms.astro create mode 100644 src/pages/en/cookie-policy.astro create mode 100644 src/pages/en/data-protection.astro create mode 100644 src/pages/en/index.astro create mode 100644 src/pages/en/legal-notice.astro create mode 100644 src/pages/en/terms.astro create mode 100644 src/pages/legal-notice.astro create mode 100644 src/pages/terms.astro diff --git a/src/components/Footer/Footer.astro b/src/components/Footer/Footer.astro index 6b3c98b..d2ce986 100644 --- a/src/components/Footer/Footer.astro +++ b/src/components/Footer/Footer.astro @@ -1,4 +1,6 @@ --- +import getTranslatedContent from "@utils/directus"; +import {getLangFromUrl, getPathForLanguage} from "../../i18n/utils"; import { Github } from "@icons/Github"; import { Instagram } from "@icons/Instagram"; import { Linkedin } from "@icons/Linkedin"; @@ -6,11 +8,10 @@ import { Podcast } from "@icons/Podcast"; import { X } from "@icons/X"; import { Xing } from "@icons/Xing"; import { Inovex } from "@icons/Inovex"; -import getTranslatedContent from "@utils/directus"; import "./Footer.scss"; -const {lang} = Astro.params; -const content = await getTranslatedContent("Footer", lang!); +const lang = getLangFromUrl(Astro.url); +const content = await getTranslatedContent("Footer", lang); ---