diff options
| author | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-26 16:58:27 +0100 |
|---|---|---|
| committer | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-26 16:58:27 +0100 |
| commit | f4eb8b6fc931f7ded138dceb2b9df4c63ac7e353 (patch) | |
| tree | ca189d7ff7beb80a2626c0747a367e745374cf78 /src/components/NewsIndex | |
| parent | c8f9f07197fa49ad114a30d4c40bdf24443acc3a (diff) | |
Differentiates getLocaleFromPath failure strategies
Diffstat (limited to 'src/components/NewsIndex')
| -rw-r--r-- | src/components/NewsIndex/NewsIndex.astro | 4 | ||||
| -rw-r--r-- | src/components/NewsIndex/NewsPreviewLink.astro | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/components/NewsIndex/NewsIndex.astro b/src/components/NewsIndex/NewsIndex.astro index 6738071..ae4c226 100644 --- a/src/components/NewsIndex/NewsIndex.astro +++ b/src/components/NewsIndex/NewsIndex.astro @@ -1,7 +1,7 @@ --- import type { CollectionEntry } from 'astro:content'; import NewsPreviewLink from './NewsPreviewLink.astro'; -import getLocaleFromPath from '$lib/getLocaleFromPath'; +import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath'; import translate from '$i18n/translate'; import tComponent from '$i18n/translations/components/newsIndex'; interface Props { @@ -10,7 +10,7 @@ interface Props { } const { headingLevel, newsItems } = Astro.props; -const locale = getLocaleFromPath(Astro.url.pathname); +const locale = getLocaleFromPathOrThrow(Astro.url.pathname); const t = translate(locale); --- diff --git a/src/components/NewsIndex/NewsPreviewLink.astro b/src/components/NewsIndex/NewsPreviewLink.astro index d698a7a..fa01d8d 100644 --- a/src/components/NewsIndex/NewsPreviewLink.astro +++ b/src/components/NewsIndex/NewsPreviewLink.astro @@ -1,7 +1,7 @@ --- import translate from '$i18n/translate'; import tComponent from '$i18n/translations/components/newsIndex'; -import getLocaleFromPath from '$lib/getLocaleFromPath'; +import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath'; import { getHref } from '$lib/newsUtils'; import type { CollectionEntry } from 'astro:content'; @@ -11,7 +11,7 @@ interface Props { } const { headingLevel, newsItem } = Astro.props; -const locale = getLocaleFromPath(Astro.url.pathname); +const locale = getLocaleFromPathOrThrow(Astro.url.pathname); const t = translate(locale); --- |
