Skip to content

Commit 4407f7e

Browse files
committed
💥 fix: navbar links pointing to wrong url and i18n
1 parent e38240a commit 4407f7e

File tree

6 files changed

+46
-17
lines changed

6 files changed

+46
-17
lines changed

src/components/Footer.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
---
2+
import { useTranslations } from "../i18n/utils";
3+
4+
const tr = useTranslations(Astro.params.lang as never);
25
---
36

47
<footer class="footer">
58
<div class="container">
6-
Made with &hearts; by retrozinndev
7-
· <a href="https://github.com/retrozinndev/retrozinndev.github.io">Improve this Page</a>
9+
{ tr("footer.txt1") } &hearts; { tr("footer.txt2") }
10+
· <a href="https://github.com/retrozinndev/retrozinndev.github.io">{ tr("footer.txt3") }</a>
811
</div>
912
</footer>
1013

src/components/NavBar.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ const tr = useTranslations(lang as never);
1515
<nav class="navbar">
1616
<ul class="links">
1717
<li class="link">
18-
<a href={ `${lang}/#top` } target="_self">{ tr("nav.home") }</a>
18+
<a href={ `/${lang}/#top` } target="_self">{ tr("nav.home") }</a>
1919
</li>
2020
<li class="link">
21-
<a href={ `${lang}/#chars` } target="_self">{ tr("nav.about") }</a>
21+
<a href={ `/${lang}/#chars` } target="_self">{ tr("nav.about") }</a>
2222
</li>
2323
<li class="link">
24-
<a href={ `${lang}/projects` } target="_self">{ tr("nav.projects") }</a>
24+
<a href={ `/${lang}/projects` } target="_self">{ tr("nav.projects") }</a>
2525
</li>
2626
</ul>
2727
</nav>

src/i18n/en.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ export const en = {
1717

1818
not_found: {
1919
title: "404 - Not found!",
20-
description: `Looks like I haven't developed this yet!
21-
Feel free to suggest me anything, talk to me on any of`,
22-
social_link: "my socials!"
20+
description: {
21+
l1: "Looks like I haven't developed this yet!",
22+
l2: "Feel free to suggest me anything, talk to me on any of",
23+
socials: "my socials!"
24+
}
25+
},
26+
27+
footer: {
28+
txt1: "Made with",
29+
txt2: "by retrozinndev",
30+
txt3: "Improve this page"
2331
}
32+
2433
} as const;

src/i18n/pt.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ export const pt = {
1717

1818
not_found: {
1919
title: "404 - Não encontrado!",
20-
description: `Parece que eu ainda não desenvolvi essa página!
21-
Feel free to suggest me anything, talk to me on any of`,
22-
social_link: "minhas redes sociais!"
20+
description: {
21+
l1: "Parece que eu ainda não desenvolvi essa página!",
22+
l2: "Se quiser sugerir alguma ideia, me chame em qualquer uma das",
23+
socials: "minhas redes sociais!"
24+
}
25+
},
26+
27+
footer: {
28+
txt1: "Feito com",
29+
txt2: "por retrozinndev",
30+
txt3: "Melhore esta página"
2331
}
2432
} as const;

src/pages/404.astro

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
---
2+
import { getLanguageFromURL, useTranslations } from "../i18n/utils";
23
import "../styles/global.css";
34
import NavBar from "../components/NavBar.astro";
45
5-
Astro.params.lang = "en";
6+
Astro.params.lang = getLanguageFromURL(Astro.url);
7+
8+
if(Astro.params.lang === undefined) {
9+
Astro.params.lang = "en";
10+
}
11+
12+
const tr = useTranslations(Astro.params.lang as never);
613
---
714

815
<!DOCTYPE html>
@@ -17,10 +24,10 @@ Astro.params.lang = "en";
1724
<body>
1825
<div class="center">
1926
<div class="not-found">
20-
<h1> 404! </h1>
27+
<h1> { tr("not_found.title") } </h1>
2128
<p>
22-
Looks like I haven't developed this yet!<br>
23-
Feel free to suggest me anything, talk to me on any of <a href="/#socials">my socials!</a>
29+
{ tr("not_found.description.l1") } <br>
30+
{ tr("not_found.description.l2") } <a href={ `/${Astro.params.lang}/#socials` }>{ tr("not_found.description.socials") }</a>
2431
</p>
2532
</div>
2633
</div>

src/pages/[lang]/index.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export { getStaticPaths };
99
const tr = useTranslations(Astro.params.lang as never);
1010
---
1111

12-
<PageLayout title={ "retrozinndev" + " | " + "Home" } icon="https://github.com/retrozinndev.png" lang="en-US">
12+
<PageLayout title={ "retrozinndev - Home" } icon="https://github.com/retrozinndev.png" lang="en-US">
1313
<body>
1414
<div class="container">
1515
<div class="about-section title">
@@ -18,7 +18,9 @@ const tr = useTranslations(Astro.params.lang as never);
1818
<div class="about" id="about">
1919
{ tr("about.description") }
2020
</div>
21-
<a href="/projects"><h3 class="projects" id="projects">{ tr("about.projects") } &UpperRightArrow;</h3></a>
21+
<a href={ `/${Astro.params.lang}/projects` }>
22+
<h3 class="projects" id="projects">{ tr("about.projects") } &UpperRightArrow;</h3>
23+
</a>
2224
<div class="socials ul" id="socials">
2325
<h2>{ tr("about.socials_title") }</h2>
2426
<SocialLinks />

0 commit comments

Comments
 (0)