|
1 | 1 | --- |
2 | 2 | import Layout from '~/layouts/Layout.astro'; |
3 | | -import { getLangFromUrl } from '~/i18n/utils'; |
| 3 | +import { getLangFromUrl, useTranslations } from '~/i18n/utils'; |
4 | 4 |
|
5 | 5 | const lang = getLangFromUrl(Astro.url); |
6 | | -
|
7 | | -const title = lang === 'en' ? 'Error 404' : 'Erreur 404'; |
8 | | -const heading = lang === 'en' ? 'Sorry, this page was not found.' : 'Désolé, cette page est introuvable.'; |
9 | | -const message = lang === 'en' |
10 | | - ? 'But don\'t worry, you can find plenty of other information on our home page.' |
11 | | - : 'Mais ne vous inquiétez pas, vous pouvez retrouver plein d\'autres informations sur notre page d\'accueil.'; |
12 | | -const buttonText = lang === 'en' ? 'Back to home' : 'Retour à l\'accueil'; |
| 6 | +const t = useTranslations(lang); |
13 | 7 | --- |
14 | 8 |
|
15 | | -<Layout metadata={{ title }}> |
| 9 | +<Layout metadata={{ title: t('notFound.title') }}> |
16 | 10 | <section class="flex items-center h-full p-16"> |
17 | 11 | <div class="container flex flex-col items-center justify-center px-5 mx-auto my-8"> |
18 | 12 | <div class="max-w-md text-center"> |
19 | 13 | <h2 class="mb-8 font-bold text-9xl"> |
20 | | - <span class="sr-only">{lang === 'en' ? 'Error' : 'Erreur'}</span> |
| 14 | + <span class="sr-only">{t('notFound.error')}</span> |
21 | 15 | <span class="text-primary">404</span> |
22 | 16 | </h2> |
23 | | - <p class="text-3xl font-semibold md:text-3xl">{heading}</p> |
| 17 | + <p class="text-3xl font-semibold md:text-3xl">{t('notFound.heading')}</p> |
24 | 18 | <p class="mt-4 mb-8 text-lg text-muted dark:text-slate-400"> |
25 | | - {message} |
| 19 | + {t('notFound.message')} |
26 | 20 | </p> |
27 | | - <a rel="noopener noreferrer" href={`/${lang}/`} class="btn ml-4">{buttonText}</a> |
| 21 | + <a rel="noopener noreferrer" href={`/${lang}/`} class="btn ml-4">{t('notFound.backToHome')}</a> |
28 | 22 | </div> |
29 | 23 | </div> |
30 | 24 | </section> |
|
0 commit comments