Skip to content

Commit

Permalink
feat: add translation system
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-gavanier committed Dec 13, 2023
1 parent 911976f commit 6d8e6cf
Show file tree
Hide file tree
Showing 41 changed files with 773 additions and 544 deletions.
30 changes: 30 additions & 0 deletions src/app/(home)/_components/About.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client';

import { ReactElement } from 'react';
import { Translate, useTranslation } from '../../_translation';
import { HomeTranslation } from '../homeTranslation';

const About = (): ReactElement => {
const { about }: HomeTranslation = useTranslation();

return (
<div className='container'>
<div className='row'>
<div className='col-lg-6 col-12'></div>
<div className='col-lg-6 col-12'>
<h2>
<small>{about.subtitle}</small> {about.title}
</h2>
<p className='lead my-4'>{about.description}</p>
<div className='d-sm-block d-grid'>
<button className='btn btn-outline-primary btn-lg' disabled>
{about.learnMore}
</button>
</div>
</div>
</div>
</div>
);
};

export default Translate(About, 'home');
40 changes: 40 additions & 0 deletions src/app/(home)/_components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use client';

import { ReactElement, useContext } from 'react';
import { NavDropdown } from 'react-bootstrap';
import Container from 'react-bootstrap/Container';
import Nav from 'react-bootstrap/Nav';
import Navbar from 'react-bootstrap/Navbar';
import { LanguageContext } from '../../_language';

export const Header = (): ReactElement => {
const [selectedLanguage, changeSelectedLanguage]: LanguageContext = useContext(LanguageContext);
// todo: translate
// const {header}: HomeTranslation = useTranslation()

return (
<Navbar expand='lg' data-bs-theme='dark'>
<Container>
<Navbar.Brand href='/'>FreelanceConnect</Navbar.Brand>
<Navbar.Toggle aria-controls='main-nav' />
<Navbar.Collapse id='main-nav'>
<Nav className='ms-auto'>
<Nav.Link href='#about'>À propos</Nav.Link>
<Nav.Link href='#schedule'>Programme</Nav.Link>
<Nav.Link href='#speakers'>Conférenciers</Nav.Link>
<Nav.Link href='#tickets'>Billets</Nav.Link>
<Nav.Link href='#sponsors'>Sponsors</Nav.Link>
<NavDropdown className='bg-opacity-10' title={`${selectedLanguage.toUpperCase()}`} id='translation-dropdown'>
<NavDropdown.Item as='button' onClick={() => changeSelectedLanguage('en')}>
🇬🇧&ensp;English (EN)
</NavDropdown.Item>
<NavDropdown.Item as='button' onClick={() => changeSelectedLanguage('fr')}>
🇫🇷&ensp;Français (FR)
</NavDropdown.Item>
</NavDropdown>
</Nav>
</Navbar.Collapse>
</Container>
</Navbar>
);
};
2 changes: 2 additions & 0 deletions src/app/(home)/_components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './About';
export * from './Header';
File renamed without changes.
8 changes: 8 additions & 0 deletions src/app/(home)/homeTranslation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type HomeTranslation = {
about: {
title: string;
subtitle: string;
description: string;
learnMore: string;
};
};
Loading

0 comments on commit 6d8e6cf

Please sign in to comment.