From 62c23f65d3e838f05d0a71c00cadb29c92fb9e0f Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Fri, 4 Aug 2023 19:04:54 +0100 Subject: Translates site title --- frontend/src/i18n/translations/site.ts | 4 ++++ frontend/src/layouts/Layout.astro | 11 ++++++++--- frontend/src/pages/[locale]/index.astro | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'frontend') diff --git a/frontend/src/i18n/translations/site.ts b/frontend/src/i18n/translations/site.ts index 83ce224..1172846 100644 --- a/frontend/src/i18n/translations/site.ts +++ b/frontend/src/i18n/translations/site.ts @@ -5,6 +5,10 @@ const siteTranslations = { 'sco': 'Scots Leid Associe', 'en-GB': 'Scots Language Society', }, + 'description': { + 'sco': 'The wabsteid o the Scots Leid Associe', + 'en-GB': 'The website of the Scots Language Society', + } }; type Keys = keyof typeof siteTranslations; diff --git a/frontend/src/layouts/Layout.astro b/frontend/src/layouts/Layout.astro index 1a47613..b17de4d 100644 --- a/frontend/src/layouts/Layout.astro +++ b/frontend/src/layouts/Layout.astro @@ -1,24 +1,29 @@ --- import Footer from '../components/Footer.astro'; +import translate from '../i18n/translate'; +import site from '../i18n/translations/site'; +import type Locale from '../types/Locale'; interface Props { + locale: Locale; title: string; } -const { title } = Astro.props; +const { locale, title } = Astro.props; +const t = translate(locale); --- - + - {title} | Scots Leid Associe + { title } | { t(site, 'title') } diff --git a/frontend/src/pages/[locale]/index.astro b/frontend/src/pages/[locale]/index.astro index 0359f45..23a270d 100644 --- a/frontend/src/pages/[locale]/index.astro +++ b/frontend/src/pages/[locale]/index.astro @@ -12,7 +12,7 @@ const locale = Astro.params.locale as Locale; const t = translate(locale); --- - +

{ t(site, 'title') }

-- cgit v1.2.3