Skip to content

Commit 7e4fe46

Browse files
committed
projects page with both languages
1 parent 65c857f commit 7e4fe46

5 files changed

Lines changed: 31 additions & 13 deletions

File tree

src/components/contact/Contact.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import cv from '/img/icons/cv.svg'
88
import github from '/img/icons/github.svg'
99
import { useNavigate } from 'react-router'
1010
import LangToggle from '../langToggle/LangToggle'
11+
import { useLanguage } from '../../context/LanguageContext'
12+
import { translations } from '../../translations'
1113

1214
function Contact() {
1315

@@ -16,6 +18,9 @@ function Contact() {
1618
navigate("/");
1719
}
1820

21+
const { language } = useLanguage();
22+
const t = translations[language].nav;
23+
1924
return (
2025
<header className={styles.ctHeader}>
2126
<nav className={styles.ctLinks}>
@@ -27,7 +32,7 @@ function Contact() {
2732
<div className={styles.ctStates}>
2833
<button className={styles.btRefresh} onClick={handleRefresh}>
2934
<img className="img-refresh" src={refresh} alt="refresh button" />
30-
<p className={styles.btLabel}>refresh</p>
35+
<p className={styles.btLabel}>{t.refresh}</p>
3136
</button>
3237
<LangToggle/>
3338
</div>

src/components/langToggle/LangToggle.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { useLanguage } from "../../context/LanguageContext";
22
import styles from './LangToggle.module.css'
3-
3+
import { translations } from '../../translations'
44

55
const LangToggle = () => {
66

77
const { language, toggleLanguage } = useLanguage();
8+
const t = translations[language].lang;
89

910
return (
1011
<div className={styles.ctLangToggle}>
@@ -13,7 +14,7 @@ const LangToggle = () => {
1314
<p className={styles.txtToggle}>{language === "en" ? "ES": "EN"}</p>
1415
</div>
1516
</div>
16-
<p className={styles.btLabel}>language</p>
17+
<p className={styles.btLabel}>{t.language}</p>
1718
</div>
1819
)
1920

src/pages/projects/Projects.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@ import Navbar from '../../components/navbar/Navbar'
22
import Divisor from '../../components/divisor/Divisor'
33
import styles from './Projects.module.css'
44
import { Link } from 'react-router'
5+
import { useLanguage } from '../../context/LanguageContext';
6+
import { translations } from '../../translations'
57

68
function Projects() {
9+
10+
const { language } = useLanguage();
11+
const t = translations[language].projects;
12+
713
return (
814
<div className={styles.ctProjects}>
915
<Divisor position="up"/>
1016
<Navbar/>
1117
<main className={styles.ctProjectType}>
12-
<Link to={"/pedagogical"} state={true} className={styles.btProjects}>Pedagogical Projects</Link>
13-
<Link to={"/professional-personal"} state={true} className={styles.btProjects}>Professional & Personal Projects</Link>
18+
<Link to={"/pedagogical"} state={true} className={styles.btProjects}>{t.pedagogical}</Link>
19+
<Link to={"/professional-personal"} state={true} className={styles.btProjects}>{t.professional}</Link>
1420
</main>
1521
<Divisor position="down"/>
1622
</div>

src/translations/en.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
"home": {
33
"title": ""
44
},
5+
"lang": {
6+
"language": "language"
7+
},
58
"nav": {
69
"home": "home",
710
"projects": "projects",
811
"tools": "tools",
9-
"green": "green"
10-
12+
"green": "green",
13+
"refresh": "refresh"
1114
},
1215
"aboutme": {
1316
"title": "ABOUT ME",
@@ -36,8 +39,8 @@
3639
"alt_carbon_calculator": "The website carbon calculator rate this page as cleaner than 97% of web pages tested. "
3740
},
3841
"projects": {
39-
"pedagogical": "",
40-
"professional": ""
42+
"pedagogical": "Pedagogical Projects",
43+
"professional": "Professional & Personal Projects"
4144
},
4245
"notfound": {
4346
"title": "Page not found"

src/translations/es.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
"home": {
33
"title": ""
44
},
5+
"lang": {
6+
"language": "idioma"
7+
},
58
"nav": {
69
"home": "inicio",
710
"projects": "proyectos",
811
"tools": "tic",
9-
"green": "verde"
10-
12+
"green": "verde",
13+
"refresh": "refrescar"
1114
},
1215
"aboutme": {
1316
"title": "ACERCA DE MÍ",
@@ -36,8 +39,8 @@
3639
"alt_carbon_calculator": "Website carbon calculator califica esta página como más limpia que el 97% de las páginas web probadas."
3740
},
3841
"projects": {
39-
"pedagogical": "",
40-
"professional": ""
42+
"pedagogical": "Proyectos educativos",
43+
"professional": "Proyectos personales y profesionales"
4144
},
4245
"notfound": {
4346
"title": "Página no encontrada"

0 commit comments

Comments
 (0)