summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Footer.astro4
-rw-r--r--src/components/LallansIssue.astro4
-rw-r--r--src/components/LallansIssueContributions.astro4
-rw-r--r--src/components/LallansIssuesGallery.astro4
-rw-r--r--src/components/Navbar/Logo.astro4
-rw-r--r--src/components/Navbar/NavLinks.astro4
-rw-r--r--src/components/NewsIndex/NewsIndex.astro4
-rw-r--r--src/components/NewsIndex/NewsPreviewLink.astro4
-rw-r--r--src/components/Scotsoun.astro4
-rw-r--r--src/components/ScotsounCdGallery.astro4
-rw-r--r--src/components/SwitchLanguageLink.astro4
11 files changed, 22 insertions, 22 deletions
diff --git a/src/components/Footer.astro b/src/components/Footer.astro
index 262a487..62b3b82 100644
--- a/src/components/Footer.astro
+++ b/src/components/Footer.astro
@@ -1,10 +1,10 @@
---
import translate from '$i18n/translate';
import tSite from '$i18n/translations/site';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrDefault } from '$lib/getLocaleFromPath';
import Button from './Button.astro';
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrDefault(Astro.url.pathname);
const t = translate(locale);
---
diff --git a/src/components/LallansIssue.astro b/src/components/LallansIssue.astro
index 37875e3..efbcdec 100644
--- a/src/components/LallansIssue.astro
+++ b/src/components/LallansIssue.astro
@@ -1,7 +1,7 @@
---
import translate from '$i18n/translate';
import tSite from '$i18n/translations/site';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';
import relativePath from '$lib/relativePath';
import type LallansIssue from '$types/LallansIssue';
import LallansIssueContributions from './LallansIssueContributions.astro';
@@ -13,7 +13,7 @@ interface Props {
}
const { issue } = Astro.props;
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const t = translate(locale);
---
diff --git a/src/components/LallansIssueContributions.astro b/src/components/LallansIssueContributions.astro
index 9cf46da..98824de 100644
--- a/src/components/LallansIssueContributions.astro
+++ b/src/components/LallansIssueContributions.astro
@@ -1,7 +1,7 @@
---
import translate from '$i18n/translate';
import tSite from '$i18n/translations/site';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';
import type { Contribution } from '$types/LallansIssue';
interface Props {
@@ -9,7 +9,7 @@ interface Props {
}
const { contributions } = Astro.props;
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const t = translate(locale);
---
diff --git a/src/components/LallansIssuesGallery.astro b/src/components/LallansIssuesGallery.astro
index b826525..76209c6 100644
--- a/src/components/LallansIssuesGallery.astro
+++ b/src/components/LallansIssuesGallery.astro
@@ -1,9 +1,9 @@
---
import { getAllLallansIssues } from '$data/lallans';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';
import type LallansIssue from '$types/LallansIssue';
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const issues = (await getAllLallansIssues()).sort(issueNumberDescending);
function issueNumberDescending(issue1: LallansIssue, issue2: LallansIssue) {
diff --git a/src/components/Navbar/Logo.astro b/src/components/Navbar/Logo.astro
index 6dc372c..dc87d19 100644
--- a/src/components/Navbar/Logo.astro
+++ b/src/components/Navbar/Logo.astro
@@ -1,9 +1,9 @@
---
import translate from '$i18n/translate';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrDefault } from '$lib/getLocaleFromPath';
import tSite from '$i18n/translations/site';
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrDefault(Astro.url.pathname);
const t = translate(locale);
---
diff --git a/src/components/Navbar/NavLinks.astro b/src/components/Navbar/NavLinks.astro
index fe2ade0..798c24e 100644
--- a/src/components/Navbar/NavLinks.astro
+++ b/src/components/Navbar/NavLinks.astro
@@ -1,11 +1,11 @@
---
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrDefault } from '$lib/getLocaleFromPath';
import translate from '$i18n/translate';
import tNews from '$i18n/translations/pages/news';
import tFurthsettins from '$i18n/translations/pages/furthsettins';
import tHame from '$i18n/translations/pages/home';
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrDefault(Astro.url.pathname);
const t = translate(locale);
---
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);
---
diff --git a/src/components/Scotsoun.astro b/src/components/Scotsoun.astro
index c1d8fdf..4825423 100644
--- a/src/components/Scotsoun.astro
+++ b/src/components/Scotsoun.astro
@@ -5,14 +5,14 @@ import tComponent from '$i18n/translations/components/scotsoun';
import type Scotsoun from '$types/Scotsoun';
import PayPalButtons from './PayPalButtons.astro';
import relativePath from '$lib/relativePath';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';
interface Props {
scotsoun: Scotsoun;
}
const { scotsoun } = Astro.props;
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const t = translate(locale);
---
diff --git a/src/components/ScotsounCdGallery.astro b/src/components/ScotsounCdGallery.astro
index 40940a1..e1a9aaf 100644
--- a/src/components/ScotsounCdGallery.astro
+++ b/src/components/ScotsounCdGallery.astro
@@ -1,9 +1,9 @@
---
import { getAllScotsoun } from '$data/scotsoun';
-import getLocaleFromPath from '$lib/getLocaleFromPath';
+import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';
import type Scotsoun from '$types/Scotsoun';
-const locale = getLocaleFromPath(Astro.url.pathname);
+const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const scotsoun = (await getAllScotsoun()).sort(scotsounIdDescending);
function scotsounIdDescending(scotsoun1: Scotsoun, scotsoun2: Scotsoun) {
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}/)?`);