From f4eb8b6fc931f7ded138dceb2b9df4c63ac7e353 Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sat, 26 Aug 2023 16:58:27 +0100 Subject: Differentiates getLocaleFromPath failure strategies --- src/components/SwitchLanguageLink.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/SwitchLanguageLink.astro') diff --git a/src/components/SwitchLanguageLink.astro b/src/components/SwitchLanguageLink.astro index d3e5ab9..fce633f 100644 --- a/src/components/SwitchLanguageLink.astro +++ b/src/components/SwitchLanguageLink.astro @@ -3,10 +3,10 @@ import tPage from '$i18n/translations/components/languageLinks'; import tSite from '$i18n/translations/site'; import translate from '$i18n/translate'; import type Locale from '$types/Locale'; -import getLocaleFromPath from '$lib/getLocaleFromPath'; +import { getLocaleFromPathOrDefault } from '$lib/getLocaleFromPath'; // This logic assumes that there are exactly two locales. -const currentLocale = getLocaleFromPath(Astro.url.pathname); +const currentLocale = getLocaleFromPathOrDefault(Astro.url.pathname); const otherLocale: Locale = currentLocale === 'sco' ? 'en-GB' : 'sco'; const currentPath = Astro.url.pathname; const currentLocaleInPath = new RegExp(`(?<=^/)(${currentLocale}/)?`); -- cgit v1.2.3