diff --git a/messages/en.json b/messages/en.json new file mode 100644 index 0000000..331269e --- /dev/null +++ b/messages/en.json @@ -0,0 +1,37 @@ +{ + "HomePage": { + "title": "Hello world!", + "about": "Go to the about page" + }, + "ProjectsSection": { + "title": "What we made", + "pixel-war": "Pixel War", + "hacker-journey": "Hacker Journey", + "forum-associatif": "Associatif Forum" + }, + "AboutSection": { + "title": "Who we are", + "description": "404 Devinci is an association focused on web development and UI/UX design. We're also interested in emerging technologies such as AI and IoT. Our aim is to bring together students who are passionate about the digital world and create innovative projects together.", + "description-2": "We work on the creation of web sites and applications, both in-house and in collaboration with our partners. We are also involved in communication activities and organize various events related to our field." + }, + "TeamSection": { + "title": "Our team", + "meet-the-team": "Meet the team", + "secretary": "Secretary ・ Fullstack Developer", + "president": "President ・ Fullstack Developer", + "treasurer": "Treasurer ・ Fullstack Developer" + }, + "FaqSection": { + "title": "questions &", + "answers": "answers", + "question-1": "Who can join the 404 Devinci association?", + "answer-1": "Whether you are a beginner or an expert, if you are a student at the Léonard de Vinci University, you can join us!", + "question-2": "Do I need coding skills to join the association?", + "answer-2": "No! We recruit UX/UI designers, communication officers, and of course developers. If you are passionate about the web, you are welcome!", + "question-3": "Are there any fees to become a member of 404 Devinci?", + "answer-3": "No, membership in the association is free. Our goal is to create a group accessible to all to work on concrete projects and improve our skills.", + "question-4": "What are the benefits of joining 404 Devinci?", + "answer-4": "By joining us, you will have the opportunity to work on real projects, improve your technical skills, and meet other web development enthusiasts. You will also be able to enhance your resume with practical experiences." +} + +} diff --git a/messages/fr.json b/messages/fr.json new file mode 100644 index 0000000..fb89392 --- /dev/null +++ b/messages/fr.json @@ -0,0 +1,41 @@ +{ + "HomePage": { + "title": "Bonjour le monde!", + "about": "Aller à la page d'à propos" + }, + "ProjectsSection": { + "title": "Ce que nous avons fait", + "pixel-war": "Pixel War", + "hacker-journey": "Hacker Journey", + "forum-associatif": "Forum Associatif" + }, + "AboutSection": { + "title": "Qui sommes-nous", + "description": "404 Devinci est une association indépendante et autonome qui se consacre à la création de sites web et d'applications pour les personnes à mobilité réduite. Nous sommes également intéressés par l'économie numérique et l'innovation, et nous sommes fiers de contribuer à la société en créant des projets concrets et en améliorant nos compétences techniques.", + "description-2": "Nous travaillons sur la création de sites web et d'applications, à la fois en tant que membre de l'association et en tant que contributeur externe. Nous sommes également impliqués dans des communications et organisons des événements liés à notre secteur." + }, + "TeamSection": { + "title": "Notre équipe", + "meet-the-team": "Rencontrer l'équipe", + "secretary": "Secrétaire ・ Fullstack Développeur", + "president": "Président ・ Fullstack Développeur", + "treasurer": "Trésorier ・ Fullstack Développeur" + }, + "FaqSection": { + "title": "questions &", + "answers": "réponses", + "question-1": "Qui peut rejoindre l'association 404 Devinci ?", + "answer-1": "Que tu sois débutant ou expert, si tu es étudiant au pôle universitaire Léonard de Vinci, tu peux nous rejoindre !", + "question-2": "Dois-je avoir des compétences en coding pour rejoindre l'association ?", + "answer-2": "Non ! Nous recrutons des designers UX/UI, des chargés de communication, et bien sûr des développeurs. Si tu es passionné par le web, tu es le bienvenu !", + "question-3": "Y a-t-il des frais pour devenir membre de la 404 Devinci ?", + "answer-3": "Non, l'adhésion à l'association est gratuite. Notre objectif est de créer un groupe accessible à tous pour travailler sur des projets concrets et améliorer nos skills.", + "question-4": "Quels sont les avantages à rejoindre la 404 Devinci ?", + "answer-4": "En nous rejoingnant, tu auras l'opportunité de travailler sur des projets concrets, d'améliorer tes compétences techniques, et de rencontrer d'autres passionnés du développement web. Tu pourras également enrichir ton CV avec des expériences pratiques." + }, + "Footer": { + "copyright": "2024 © Tous droits réservés", + "legal-notices": "Mentions légales", + "social-media": "Réseaux sociaux" + } +} diff --git a/src/components/buttons/SelectLocale.tsx b/src/components/buttons/SelectLocale.tsx index c952712..993ca15 100644 --- a/src/components/buttons/SelectLocale.tsx +++ b/src/components/buttons/SelectLocale.tsx @@ -1,8 +1,6 @@ 'use client'; import { useLocale } from 'next-intl'; -import clsx from 'clsx'; -import { useParams } from 'next/navigation'; -import { ReactNode, useTransition, useState } from 'react'; +import { useTransition, useState } from 'react'; import { usePathname, useRouter } from '@/i18n/routing'; import { Select, @@ -18,23 +16,22 @@ export default function LocaleSwitcherSelect() { const router = useRouter(); const [isPending, startTransition] = useTransition(); const pathname = usePathname(); - const params = useParams(); - const initialLocale = useLocale(); - const [locale, setLocale] = useState(initialLocale); + const initialLocale = useLocale() as 'en' | 'fr'; + const [locale, setLocale] = useState<'en' | 'fr'>(initialLocale); - function onValueChange(nextLocale: string) { + function onValueChange(nextLocale: 'en' | 'fr') { setLocale(nextLocale); - console.log(nextLocale); + startTransition(() => { router.replace( - pathname, // Changer ici pour passer un string - { query: params, locale: nextLocale as string } // Regrouper les options + pathname, + { locale: nextLocale } ); }); } return ( - @@ -43,7 +40,7 @@ export default function LocaleSwitcherSelect() { Select Language English Français - {/* Ajoutez d'autres options de langue ici */} + diff --git a/src/components/content.tsx b/src/components/content.tsx index 29fc73b..df14287 100644 --- a/src/components/content.tsx +++ b/src/components/content.tsx @@ -2,6 +2,7 @@ import { gasoekOne } from "@/app/[locale]/font" import cn from "@/utils/function" import Arrow from "./arrow" import LocaleSwitcherSelect from "../components/buttons/SelectLocale"; +import { useTranslations } from "next-intl"; export default function Content() { @@ -15,6 +16,7 @@ export default function Content() { const BottomFooter = () => { + const t = useTranslations('Footer'); return (

{

-

2024 © All Rights Reserved

-

Legal notices

+

{t('copyright')}

+

{t('legal-notices')}

) } const Nav = () => { + const t = useTranslations('Footer'); return (
-

Social media

+

+ {t('social-media')} +

{ + + const t = useTranslations('FaqSection'); + return ( -

- questions & - answers + {t('title')} + {t('answers')}

- {faqData.en.map(({ question, answer }, index) => ( -
( +
-

{question}

-

{answer}

+

+ {t(`question-${index + 1}`)} +

+

{t(`answer-${index + 1}`)}

))}
diff --git a/src/components/sections/team.tsx b/src/components/sections/team.tsx index 1477371..de40335 100644 --- a/src/components/sections/team.tsx +++ b/src/components/sections/team.tsx @@ -1,46 +1,54 @@ import Arrow from "../arrow"; import H2 from "../heading2"; import MemberCard from "../member-card"; +import {useTranslations} from 'next-intl'; const members = [ { "name": "Nicolas", "position": "President・Fullstack Developer", + "slug": "president", "image": "nicolas.jpg", }, { "name": "Mattéo", "position": "Secretary・Fullstack Developer", "image": "matteo.jpg", + "slug": "secretary", }, { "name": "Michel", "position": "Treasurer・Fullstack Developer", "image": "michel.png", + "slug": "treasurer", }, ] const TeamSection = () => { + + const t = useTranslations('TeamSection'); return (

- Our team + {t('title')}

- Meet the team + {t('meet-the-team')}
{members.map((member, index) => ( - + ))}
diff --git a/src/i18n/request.ts b/src/i18n/request.ts index 4880df9..5c6dc4f 100644 --- a/src/i18n/request.ts +++ b/src/i18n/request.ts @@ -4,7 +4,7 @@ import {routing} from './routing'; export default getRequestConfig(async ({locale}) => { // Validate that the incoming `locale` parameter is valid - if (!routing.locales.includes(locale as any)) notFound(); + if (!routing.locales.includes(locale as 'fr' || "en")) notFound(); return { messages: (await import(`../../messages/${locale}.json`)).default diff --git a/src/i18n/routing.ts b/src/i18n/routing.ts index 6e0caa3..9ed76a7 100644 --- a/src/i18n/routing.ts +++ b/src/i18n/routing.ts @@ -6,10 +6,8 @@ export const routing = defineRouting({ locales: ['en', 'fr'], // Used when no locale matches - defaultLocale: 'en' + defaultLocale: 'fr' }); -// Lightweight wrappers around Next.js' navigation APIs -// that will consider the routing configuration export const {Link, redirect, usePathname, useRouter} = createSharedPathnamesNavigation(routing); \ No newline at end of file