Skip to content

Commit

Permalink
fixed localisations of titles
Browse files Browse the repository at this point in the history
  • Loading branch information
kgalb01 committed Jan 29, 2025
1 parent a247ff0 commit ea6a6a8
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 53 deletions.
30 changes: 30 additions & 0 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,5 +482,35 @@
"theme.contentVisibility.draftBanner.message": {
"message": "This page is a draft. It will only be visible in dev and be excluded from the production build.",
"description": "The draft content banner message"
},
":edu S2": {
"message": ":edu S2"
},
":edu": {
"message": ":edu"
},
":bike": {
"message": ":bike"
},
":CO2 Ampel": {
"message": ":CO2 Traffic Light"
},
":home": {
"message": ":home"
},
":mini": {
"message": ":mini"
},
"openSenseMap": {
"message": "openSenseMap"
},
"Blockly": {
"message": "Blockly"
},
"Hardware Glossar": {
"message": "Hardware Glossary"
},
"senseBox Dokumentation": {
"message": "senseBox Documentation"
}
}
4 changes: 2 additions & 2 deletions i18n/en/docusaurus-theme-classic/footer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"description": "The title of the footer links column with title=Community in the footer"
},
"link.item.label.Impressum": {
"message": "Impressum",
"description": "The label of footer link with label=Impressum linking to https://sensebox.de/impressum"
"message": "Imprint",
"description": "The label of footer link with label=Impressum linking to https://sensebox.de/de/imprint"
},
"link.item.label.openSenseMap": {
"message": "openSenseMap",
Expand Down
117 changes: 66 additions & 51 deletions src/components/HomepageFeatures/index.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
import React from 'react'
import clsx from 'clsx'
import styles from './styles.module.css'
import Link from '@docusaurus/Link'
import React from 'react';
import clsx from 'clsx';
import styles from './styles.module.css';
import Link from '@docusaurus/Link';
import Translate, {translate} from '@docusaurus/Translate';
import LogoSensebox from '@site/static/img/logo.svg'
import osem from '@site/static/img/osem.png'
import blockly from '@site/static/img/blockly.png'
import hardware from '@site/static/img/hardware.jpg'
import { useBoardStore } from '@site/src/lib/stores/store'
import LogoSensebox from '@site/static/img/logo.svg';
import osem from '@site/static/img/osem.png';
import blockly from '@site/static/img/blockly.png';
import hardware from '@site/static/img/hardware.jpg';
import { useBoardStore } from '@site/src/lib/stores/store';

// Localisation function for the title
const translateTitle = (title) => {
const translations = {
':edu S2': translate({ message: ':edu S2' }),
':edu': translate({ message: ':edu' }),
':bike': translate({ message: ':bike' }),
':CO2 Ampel': translate({ message: ':CO2 Ampel' }),
':home': translate({ message: ':home' }),
':mini': translate({ message: ':mini' }),
'openSenseMap': translate({ message: 'openSenseMap' }),
'Blockly': translate({ message: 'Blockly' }),
'Hardware Glossar': translate({ message: 'Hardware Glossar' }),
'senseBox Dokumentation': translate({ message: 'senseBox Dokumentation' }), // Neue Zeile
};
return translations[title] || title;
};

const FeatureList = [
{
title: ':edu S2',
title: translateTitle(':edu S2'),
description: (
<Translate>
Die zweite Generation der senseBox:edu für den Einsatz im
Expand All @@ -21,7 +38,7 @@ const FeatureList = [
to: '/docs/boards/mcus2/mcu-s2-overview?board=edus2',
},
{
title: ':edu',
title: translateTitle(':edu'),
description: (
<Translate>
Informationen zum Anschluss und zur Programmierung der senseBox:edu für
Expand All @@ -31,7 +48,7 @@ const FeatureList = [
to: '/docs/boards/mcu/mcu-overview?board=edu',
},
{
title: ':bike',
title: translateTitle(':bike'),
description: (
<Translate>
Anleitung und Informationen zur senseBox:bike, der dazugehörigen App und
Expand All @@ -41,7 +58,7 @@ const FeatureList = [
to: '/docs/category/bike?board=bike',
},
{
title: ':CO2 Ampel',
title: translateTitle(':CO2 Ampel'),
description: (
<Translate>
Informationen zum Anschluss und Programmierung der Sensoren, Bees und
Expand All @@ -51,7 +68,7 @@ const FeatureList = [
to: '/docs/products/co2Ampel/co2Ampel-overview?board=co2',
},
{
title: ':home',
title: translateTitle(':home'),
description: (
<Translate>
Aufstellungsort, Installation und alle weiteren Informationen zu
Expand All @@ -61,7 +78,7 @@ const FeatureList = [
to: '/docs/boards/mcu/mcu-overview?board=home',
},
{
title: ':mini',
title: translateTitle(':mini'),
description: (
<Translate>
Alle relevanten Informationen zur Miniaturversion der senseBox findest
Expand All @@ -70,11 +87,11 @@ const FeatureList = [
),
to: '/docs/boards/mini/mini-overview?board=mini',
},
]
];

const ThumbNailPreviewList = [
{
title: 'openSenseMap',
title: translateTitle('openSenseMap'),
Image: osem,
description: (
<Translate>
Expand All @@ -84,7 +101,7 @@ const ThumbNailPreviewList = [
to: 'https://docs.opensensemap.org/',
},
{
title: 'Blockly',
title: translateTitle('Blockly'),
Image: blockly,
description: (
<Translate>
Expand All @@ -97,7 +114,7 @@ const ThumbNailPreviewList = [
to: '/docs/category/blockly-2',
},
{
title: 'Hardware Glossar',
title: translateTitle('Hardware Glossar'),
Image: hardware,
description: (
<Translate>
Expand All @@ -110,7 +127,7 @@ const ThumbNailPreviewList = [
},
to: '/docs/category/glossar',
},
]
];

function ThumbailPreview({ Image, title, description, onClick, to }) {
return (
Expand All @@ -131,10 +148,7 @@ function ThumbailPreview({ Image, title, description, onClick, to }) {

function Feature({ title, description, to }) {
const handleBoardChange = selectedBoard => {
// Verwende die setBoard-Funktion direkt, um das Board im Store zu aktualisieren
useBoardStore.setState({ board: selectedBoard })

// Hier kannst du weitere Aktionen ausführen, wenn sich das Board ändert
}

return (
Expand All @@ -153,32 +167,33 @@ function Feature({ title, description, to }) {
</Link>
)
}

export default function HomepageFeatures() {
return (
<section className="flex flex-col">
<div>
<div className="flex flex-col gap-20 bg-gradient-to-r from-green to-green-3 p-8">
<div className="flex flex-col items-center justify-evenly lg:flex-row">
<div className="text-center text-white">
<h1 className="font-bold">senseBox Dokumentation</h1>
<p><Translate>Der Platz für die senseBox-Dokumentation.</Translate></p>
</div>
<div>
<LogoSensebox />
</div>
</div>
<div className="flex flex-wrap justify-center gap-4 lg:flex-row">
{FeatureList.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</div>
<div className="flex flex-col justify-center gap-4 p-4 lg:flex-row lg:gap-0 lg:p-20">
{ThumbNailPreviewList.map((props, idx) => (
<ThumbailPreview key={idx} {...props} />
))}
</div>
</section>
)
}
return (
<section className="flex flex-col">
<div>
<div className="flex flex-col gap-20 bg-gradient-to-r from-green to-green-3 p-8">
<div className="flex flex-col items-center justify-evenly lg:flex-row">
<div className="text-center text-white">
<h1 className="font-bold">{translateTitle('senseBox Dokumentation')}</h1>
<p><Translate>Der Platz für die senseBox-Dokumentation.</Translate></p>
</div>
<div>
<LogoSensebox />
</div>
</div>
<div className="flex flex-wrap justify-center gap-4 lg:flex-row">
{FeatureList.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</div>
<div className="flex flex-col justify-center gap-4 p-4 lg:flex-row lg:gap-0 lg:p-20">
{ThumbNailPreviewList.map((props, idx) => (
<ThumbailPreview key={idx} {...props} />
))}
</div>
</section>
)
}

0 comments on commit ea6a6a8

Please sign in to comment.