Skip to content

Commit fc839c2

Browse files
Copilotneilime
andcommitted
Use translation helpers consistently: translate alt text and refactor 404 page
Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent cecf026 commit fc839c2

4 files changed

Lines changed: 22 additions & 14 deletions

File tree

application/src/i18n/locales/en.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default {
1515
'footer.terms': 'Terms of Service',
1616
'footer.privacy': 'Privacy Policy',
1717
'footer.note': 'Designed by the <a class="text-blue-600 underline dark:text-muted" href="https://cloudnative-provence.fr/">Cloud Native Provence community</a> · All rights reserved.',
18+
'footer.logoAlt': 'Cloud Native Provence Logo',
1819

1920
'home.hero.cta.participate': 'I want to participate',
2021
'home.hero.cta.learnMore': 'Learn more',
@@ -27,6 +28,12 @@ export default {
2728
'home.features.tagline': 'Why attend?',
2829
'home.features.title': 'Cloud Native Provence at a glance',
2930

31+
'notFound.title': 'Error 404',
32+
'notFound.error': 'Error',
33+
'notFound.heading': 'Sorry, this page was not found.',
34+
'notFound.message': 'But don\'t worry, you can find plenty of other information on our home page.',
35+
'notFound.backToHome': 'Back to home',
36+
3037
'meta.title.default': 'Cloud Native Provence',
3138
'meta.title.template': '%s — Cloud Native Provence',
3239
'meta.description': 'The Cloud Native & Kubernetes day in Aix-en-Provence, organized by the community.',

application/src/i18n/locales/fr.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default {
1515
'footer.terms': 'Mentions légales',
1616
'footer.privacy': 'Politique de confidentialité',
1717
'footer.note': 'Conçu par la <a class="text-blue-600 underline dark:text-muted" href="https://cloudnative-provence.fr/">communauté Cloud Native Provence</a> · Tous droits réservés.',
18+
'footer.logoAlt': 'Logo Cloud Native Provence',
1819

1920
'home.hero.cta.participate': 'Je veux participer',
2021
'home.hero.cta.learnMore': 'En savoir plus',
@@ -27,6 +28,12 @@ export default {
2728
'home.features.tagline': 'Pourquoi venir ?',
2829
'home.features.title': 'Cloud Native Provence en un clin d\'œil',
2930

31+
'notFound.title': 'Erreur 404',
32+
'notFound.error': 'Erreur',
33+
'notFound.heading': 'Désolé, cette page est introuvable.',
34+
'notFound.message': 'Mais ne vous inquiétez pas, vous pouvez retrouver plein d\'autres informations sur notre page d\'accueil.',
35+
'notFound.backToHome': 'Retour à l\'accueil',
36+
3037
'meta.title.default': 'Cloud Native Provence',
3138
'meta.title.template': '%s — Cloud Native Provence',
3239
'meta.description': 'La journée Cloud Native & Kubernetes à Aix-en-Provence, organisée par la communauté.',

application/src/navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const getFooterData = (locale: string = 'fr') => {
5252
],
5353
socialLinks: [],
5454
footNote: `
55-
<img class="w-5 h-5 md:w-6 md:h-6 md:-mt-0.5 bg-cover mr-1.5 rtl:mr-0 rtl:ml-1.5 float-left rtl:float-right rounded-sm" src="${favIcon.src}" alt="Logo Cloud Native Provence" loading="lazy" />
55+
<img class="w-5 h-5 md:w-6 md:h-6 md:-mt-0.5 bg-cover mr-1.5 rtl:mr-0 rtl:ml-1.5 float-left rtl:float-right rounded-sm" src="${favIcon.src}" alt="${t('footer.logoAlt')}" loading="lazy" />
5656
${t('footer.note')}
5757
`,
5858
};

application/src/pages/404.astro

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
---
22
import Layout from '~/layouts/Layout.astro';
3-
import { getLangFromUrl } from '~/i18n/utils';
3+
import { getLangFromUrl, useTranslations } from '~/i18n/utils';
44
55
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);
137
---
148

15-
<Layout metadata={{ title }}>
9+
<Layout metadata={{ title: t('notFound.title') }}>
1610
<section class="flex items-center h-full p-16">
1711
<div class="container flex flex-col items-center justify-center px-5 mx-auto my-8">
1812
<div class="max-w-md text-center">
1913
<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>
2115
<span class="text-primary">404</span>
2216
</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>
2418
<p class="mt-4 mb-8 text-lg text-muted dark:text-slate-400">
25-
{message}
19+
{t('notFound.message')}
2620
</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>
2822
</div>
2923
</div>
3024
</section>

0 commit comments

Comments
 (0)