i18n integration for showcase

Moved showcase carousel data source to respective i18n/ language files
This commit is contained in:
Blboun3 2024-05-28 12:21:34 +02:00
parent 0c2600a7f6
commit 986ea7ef3f
No known key found for this signature in database
7 changed files with 137 additions and 41 deletions

View File

@ -8,6 +8,6 @@ const { title, description } = dictionary[Astro.currentLocale];
<SinglePage>
<div class="flex flex-col h-screen">
<ShowcaseTabs client:load />
<ShowcaseTabs currentLocale={Astro.currentLocale} client:load />
</div>
</SinglePage>

View File

@ -12,20 +12,22 @@ import {
TabsTrigger,
} from "../components/ui/tabs";
import { data } from "../content/showcase";
import { dictionary } from "../i18n/dictionary";
export function ShowcaseTabs() {
export function ShowcaseTabs({ currentLocale }) {
const { showcase } = dictionary[currentLocale];
return (
<Tabs
defaultValue={data[0].value}
defaultValue={showcase[0].value}
className="bottom-0 flex flex-col h-full my-auto"
>
<TabsList className={`grid w-full mt-4 grid-cols-${data.length}`}>
{data.map((item) => (
<TabsList className={`grid w-full mt-4 grid-cols-${showcase.length}`}>
{showcase.map((item) => (
<TabsTrigger value={item.value} key={item.value}>{item.handle}</TabsTrigger>
))}
</TabsList>
{data.map((item) => (
{showcase.map((item) => (
<TabsContent value={item.value} className="h-full" key={item.value}>
<Card className="h-[90%] my-auto">
<CardHeader>

View File

@ -1,29 +0,0 @@
export const data = [
{
value: "thisPage",
handle: "Projekt 1",
title: "This Page",
href: "/potato",
description: "random text os iuoiu fsd ufiodsu foid sufo dsufois dufoisd eee sfsdffsdfsd sd sd ds dsfsv sd dss ds ds ufiosdufi osdufsdfsd iofusdoifudu siofsdfids ofudsiouoi",
image: "/temp.jpg",
imageAlt: "text"
},
{
value: "thatPage",
title: "That Page",
handle: "Projekt 2",
href: "/potat2",
description: "random text",
image: "/temp.jpg",
imageAlt: "text"
},
{
value: "otherPage",
title: "Other Page",
handle: "Projekt 3",
href: "/kartoffeln",
description: "random text",
image: "/temp.jpg",
imageAlt: "text"
},
];

View File

@ -1,3 +1,33 @@
export const cs = {
title: "CS Test",
showcase: [
{
value: "thisPage",
handle: "Projekt 1",
title: "This Page",
href: "/potato",
description:
"random text os iuoiu fsd ufiodsu foid sufo dsufois dufoisd eee sfsdffsdfsd sd sd ds dsfsv sd dss ds ds ufiosdufi osdufsdfsd iofusdoifudu siofsdfids ofudsiouoi",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "thatPage",
title: "That Page",
handle: "Projekt 2",
href: "/potat2",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "otherPage",
title: "Other Page",
handle: "Projekt 3",
href: "/kartoffeln",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
],
};

View File

@ -1,3 +1,34 @@
export const de = {
title: "DE Test",
};
showcase: [
{
value: "thisPage",
handle: "Projekt 1 DE",
title: "This Page",
href: "/potato",
description:
"random text os iuoiu fsd ufiodsu foid sufo dsufois dufoisd eee sfsdffsdfsd sd sd ds dsfsv sd dss ds ds ufiosdufi osdufsdfsd iofusdoifudu siofsdfids ofudsiouoi",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "thatPage",
title: "That Page",
handle: "Projekt 2 DE",
href: "/potat2",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "otherPage",
title: "Other Page",
handle: "Projekt 3 DE",
href: "/kartoffeln",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
],
};

View File

@ -1,3 +1,34 @@
export const en = {
title: "EN Test",
};
showcase: [
{
value: "thisPage",
handle: "Projekt 1 EN",
title: "This Page",
href: "/potato",
description:
"random text os iuoiu fsd ufiodsu foid sufo dsufois dufoisd eee sfsdffsdfsd sd sd ds dsfsv sd dss ds ds ufiosdufi osdufsdfsd iofusdoifudu siofsdfids ofudsiouoi",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "thatPage",
title: "That Page",
handle: "Projekt 2 EN",
href: "/potat2",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "otherPage",
title: "Other Page",
handle: "Projekt 3 EN",
href: "/kartoffeln",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
],
};

View File

@ -1,3 +1,34 @@
export const fr = {
title: "FR Test",
};
showcase: [
{
value: "thisPage",
handle: "Projekt 1 FR",
title: "This Page",
href: "/potato",
description:
"random text os iuoiu fsd ufiodsu foid sufo dsufois dufoisd eee sfsdffsdfsd sd sd ds dsfsv sd dss ds ds ufiosdufi osdufsdfsd iofusdoifudu siofsdfids ofudsiouoi",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "thatPage",
title: "That Page",
handle: "Projekt 2 FR",
href: "/potat2",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
{
value: "otherPage",
title: "Other Page",
handle: "Projekt 3 FR",
href: "/kartoffeln",
description: "random text",
image: "/temp.jpg",
imageAlt: "text",
},
],
};