diff options
| -rw-r--r-- | frontend/src/i18n/translations/pages/home.ts | 11 | ||||
| -rw-r--r-- | frontend/src/i18n/translations/site.ts | 11 | ||||
| -rw-r--r-- | frontend/src/pages/[locale]/index.astro | 11 |
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> |
