diff --git a/src/components/About.astro b/src/components/About.astro index f1ed7ee..98b63d7 100644 --- a/src/components/About.astro +++ b/src/components/About.astro @@ -1,22 +1,30 @@ --- -import SinglePage from "../layouts/SinglePage.astro" +import SinglePage from "../layouts/SinglePage.astro"; -import { dictionary } from "../i18n/dictionary"; import AboutModule from "./AboutModule.astro"; -const { title, description } = dictionary[Astro.currentLocale]; +import { getLangFromUrl, useTranslations } from "../i18n/utils"; + +const t = useTranslations(getLangFromUrl(Astro.url)); --- + -
- -

Lorem

-

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Atque consequatur voluptatibus nobis dolores repellendus similique, ut sit odit commodi optio tempore totam, quaerat at distinctio nisi dolore magnam quia perferendis.

-
- -

Ipsum

-

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Atque consequatur voluptatibus nobis dolores repellendus similique, ut sit odit commodi optio tempore totam, quaerat at distinctio nisi dolore magnam quia perferendis.

-
- -

Dolor

-

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Atque consequatur voluptatibus nobis dolores repellendus similique, ut sit odit commodi optio tempore totam, quaerat at distinctio nisi dolore magnam quia perferendis.

-
+
+ + { + [0,1,2].map(i => + +

+ {t("about")[i].title} +

+

+ {t("about")[i].content} +

+
+ ) + } +
diff --git a/src/components/Hero.astro b/src/components/Hero.astro index b25d628..b103a4a 100644 --- a/src/components/Hero.astro +++ b/src/components/Hero.astro @@ -1,26 +1,22 @@ --- import SinglePage from "../layouts/SinglePage.astro"; +import { getLangFromUrl, useTranslations } from "../i18n/utils"; -import { dictionary } from "../i18n/dictionary"; -const { title, description } = dictionary[Astro.currentLocale]; +const t = useTranslations(getLangFromUrl(Astro.url)) ---
- - +

- Lorem Ipsum + {t("hero").title}

- Lorem ipsum dolor, sit amet consectetur adipisicing elit. A suscipit - facilis doloribus, dicta cupiditate sint nisi ad explicabo cumque - dolorem quaerat hic aliquid. Iste quia aspernatur nam distinctio, - animi dolorum? + {t("hero").content}

@@ -28,12 +24,12 @@ const { title, description } = dictionary[Astro.currentLocale]; {t("hero").buttons[0]} {t("hero").buttons[1]}
diff --git a/src/components/ShowcaseTabs.jsx b/src/components/ShowcaseTabs.jsx index 9d145b3..244c8bc 100644 --- a/src/components/ShowcaseTabs.jsx +++ b/src/components/ShowcaseTabs.jsx @@ -1,3 +1,4 @@ +import { useTranslations } from "../i18n/utils"; import { Card, CardContent, @@ -12,11 +13,10 @@ import { TabsTrigger, } from "../components/ui/tabs"; -import { dictionary } from "../i18n/dictionary"; - export function ShowcaseTabs({ currentLocale }) { - const { showcase } = dictionary[currentLocale]; + const t = useTranslations(currentLocale); + const showcase = t("showcase"); return ( - + @@ -12,7 +15,7 @@ import "../style/index.css"; - + {title} diff --git a/src/pages/[lang]/blog/[...slug].astro b/src/pages/[lang]/blog/[...slug].astro index 2739664..8a1209f 100644 --- a/src/pages/[lang]/blog/[...slug].astro +++ b/src/pages/[lang]/blog/[...slug].astro @@ -32,6 +32,11 @@ const { Content } = await page.render();

{page.data.title}

{page.data.author} • {formattedDate}

+
+ { page.data.tags?.map((tag) => + #{tag} + )} +
diff --git a/src/pages/[lang]/blog/index.astro b/src/pages/[lang]/blog/index.astro index 32dbaeb..803d8fe 100644 --- a/src/pages/[lang]/blog/index.astro +++ b/src/pages/[lang]/blog/index.astro @@ -18,6 +18,7 @@ var posts = await getBlogPosts(); var filtered_posts = posts.filter( (post) => post.data.language == Astro.currentLocale, ); + --- diff --git a/src/pages/[lang]/blog/tags/[tag].astro b/src/pages/[lang]/blog/tags/[tag].astro index f05d23a..d5e2104 100644 --- a/src/pages/[lang]/blog/tags/[tag].astro +++ b/src/pages/[lang]/blog/tags/[tag].astro @@ -1,7 +1,7 @@ --- import MainLayout from "../../../../layouts/MainLayout.astro"; import SinglePageBlogMode from "../../../../layouts/SinglePageBlogMode.astro"; -import { LANGUAGES } from "../../../../i18n/utils"; +import { LANGUAGES, getLangFromUrl, useTranslations } from "../../../../i18n/utils"; import { getBlogPosts } from "../../../../content/config"; import PostsList from "../../../../components/PostsList.astro"; @@ -10,19 +10,23 @@ export async function getStaticPaths() { const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())]; var paths = []; - + tags.map((tag) => { Object.keys(LANGUAGES).map((lang) => { - paths.push({ + if(tag){ + paths.push({ params: { lang: lang, tag: tag }, props: { posts: allPosts }, }); + } }); }); - + return paths; } +const t = useTranslations(getLangFromUrl(Astro.url)) + const { lang, tag } = Astro.params; const { posts } = Astro.props; @@ -31,6 +35,7 @@ const filteredPosts = posts.filter((post) => post.data.tags?.includes(tag) && po +

{t("postsTagged")} "{tag}"

diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro index fa28769..b4324e8 100644 --- a/src/pages/[lang]/index.astro +++ b/src/pages/[lang]/index.astro @@ -5,9 +5,9 @@ import About from "../../components/About.astro"; import Showcase from "../../components/Showcase.astro"; //@ts-ignore -import { dictionary } from "../../i18n/dictionary"; +import { getLangFromUrl, useTranslations } from "../../i18n/utils"; -const { title, description } = dictionary[Astro.currentLocale]; +const t = useTranslations(getLangFromUrl(Astro.url)); export async function getStaticPaths() { return ["en", "fr", "cs", "de"].map((lang) => { @@ -15,7 +15,7 @@ export async function getStaticPaths() { }); } --- - + diff --git a/src/style/index.css b/src/style/index.css index fdec1a6..ea5f0e9 100644 --- a/src/style/index.css +++ b/src/style/index.css @@ -12,7 +12,7 @@ Dark Mode: https://www.realtimecolors.com/dashboard?colors=e7e7e9-0f0f0f-5819c5 Light mode */ --light-color-bkg: 0deg, 0%, 94%; - --light-color-bkgNavbar: 0deg, 0%, 20%; + --light-color-bkgNavbar: 0deg, 0%, 50%; --light-color-content: 240deg, 4%, 9%; --light-color-primary: 54deg, 100%, 50%; --light-color-secondary: 237deg, 100%, 93%; @@ -25,8 +25,8 @@ Dark Mode: https://www.realtimecolors.com/dashboard?colors=e7e7e9-0f0f0f-5819c5 --light-input: 214.3 31.8% 91.4%; --light-muted: 210 40% 96.1%; --light-muted-foreground: 215 17% 34%; - --light-popover: 0 0% 100%; /* merge to bkgNavbar */ - --light-popover-foreground: 222.2 47.4% 11.2%; /* merge to bkg */ + --light-popover: 0 0% 100%; + --light-popover-foreground: 222.2 47.4% 11.2%; --light-border: 214.3 31.8% 91.4%; --light-card: 0 0% 100%; --light-card-foreground: 222.2 47.4% 11.2%; @@ -52,8 +52,8 @@ Dark Mode: https://www.realtimecolors.com/dashboard?colors=e7e7e9-0f0f0f-5819c5 --dark-input: 216 34% 17%; --dark-muted: 0 0% 15%; --dark-muted-foreground: 215.4 31% 71%; - --dark-popover: 224 71% 4%; /* merge to bkgNavbar */ - --dark-popover-foreground: 215 20.2% 65.1%; /* merge to bkg */ + --dark-popover: 224 71% 4%; + --dark-popover-foreground: 215 20.2% 65.1%; --dark-border: 9 20% 21%; --dark-card: 0 0% 15%; --dark-card-foreground: 213 31% 91%;