From 7e0219994b0f62b7d17310f5adebb549e129c952 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Wed, 8 Jan 2025 18:40:15 +0000 Subject: Fixes English news feed --- src/lib/getLocaleFromPath.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/getLocaleFromPath.ts') diff --git a/src/lib/getLocaleFromPath.ts b/src/lib/getLocaleFromPath.ts index 2cfaf41..b1e815c 100644 --- a/src/lib/getLocaleFromPath.ts +++ b/src/lib/getLocaleFromPath.ts @@ -1,13 +1,14 @@ import locales, { defaultLocale } from '$i18n/locales'; import type Locale from '$types/Locale'; +import { correctLocaleCasing } from './correctLocaleCasing'; export function getLocaleFromPath(path: string): Locale | null { - const regex = new RegExp(`^/(${locales.join('|')})`); + const regex = new RegExp(`^/(${locales.join('|')})`, 'i'); const match = path.match(regex)?.[1]; if (!match) { return null; } - return match as Locale; + return correctLocaleCasing(match) as Locale; } export function getLocaleFromPathOrDefault(path: string): Locale { -- cgit v1.2.3