summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <jcarstairs@scottlogic.com>2023-08-04 19:01:15 +0100
committerJoe Carstairs <jcarstairs@scottlogic.com>2023-08-04 19:01:15 +0100
commit44ee01331fd7f7f8426b3771244692e263340a15 (patch)
tree6986bd8fc427e90e7d8dffc1da2867e6101b17d8
parentec4407043eb26f47412226add229e7e60ef3dbcb (diff)
Localizes homepage
-rw-r--r--frontend/src/i18n/translations/pages/home.ts11
-rw-r--r--frontend/src/i18n/translations/site.ts11
-rw-r--r--frontend/src/pages/[locale]/index.astro11
3 files changed, 31 insertions, 2 deletions
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<Keys>; \ 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<Keys>; \ 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);
---
-<Layout title="Hame">
+<Layout title={ t(home, 'title') }>
<main id="main">
<section>
- <h1 class="title">Scots Leid Associe</h1>
+ <h1 class="title">{ t(site, 'title') }</h1>
<h1>Tap-level heidin</h1>
<h2>Seicont-level heidin</h2>
<h3>Third-level heidin</h3>