From 44ee01331fd7f7f8426b3771244692e263340a15 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Fri, 4 Aug 2023 19:01:15 +0100 Subject: Localizes homepage --- frontend/src/i18n/translations/pages/home.ts | 11 +++++++++++ frontend/src/i18n/translations/site.ts | 11 +++++++++++ frontend/src/pages/[locale]/index.astro | 11 +++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 frontend/src/i18n/translations/pages/home.ts create mode 100644 frontend/src/i18n/translations/site.ts (limited to 'frontend/src') diff --git a/frontend/src/i18n/translations/pages/home.ts b/frontend/src/i18n/translations/pages/home.ts new file mode 100644 index 0000000..1415024 --- /dev/null +++ b/frontend/src/i18n/translations/pages/home.ts @@ -0,0 +1,11 @@ +import type { TranslationsDictionary } from "../../../types/TranslationsDictionary"; + +const homeTranslations = { + 'title': { + 'sco': 'Hame', + 'en-GB': 'Home', + }, +}; + +type Keys = keyof typeof homeTranslations; +export default homeTranslations as TranslationsDictionary; \ No newline at end of file diff --git a/frontend/src/i18n/translations/site.ts b/frontend/src/i18n/translations/site.ts new file mode 100644 index 0000000..83ce224 --- /dev/null +++ b/frontend/src/i18n/translations/site.ts @@ -0,0 +1,11 @@ +import type { TranslationsDictionary } from "../../types/TranslationsDictionary"; + +const siteTranslations = { + 'title': { + 'sco': 'Scots Leid Associe', + 'en-GB': 'Scots Language Society', + }, +}; + +type Keys = keyof typeof siteTranslations; +export default siteTranslations as TranslationsDictionary; \ No newline at end of file diff --git a/frontend/src/pages/[locale]/index.astro b/frontend/src/pages/[locale]/index.astro index fdb9ff9..0359f45 100644 --- a/frontend/src/pages/[locale]/index.astro +++ b/frontend/src/pages/[locale]/index.astro @@ -1,14 +1,21 @@ --- import Layout from '../../layouts/Layout.astro'; import staticPaths from './staticPaths'; +import translate from '../../i18n/translate'; +import site from '../../i18n/translations/site'; +import home from '../../i18n/translations/pages/home'; +import type Locale from '../../types/Locale'; export async function getStaticPaths() { return staticPaths; } + +const locale = Astro.params.locale as Locale; +const t = translate(locale); --- - +
-

Scots Leid Associe

+

{ t(site, 'title') }

Tap-level heidin

Seicont-level heidin

Third-level heidin

-- cgit v1.2.3