Added english

This commit is contained in:
Clemens Hering
2025-11-03 07:43:47 +01:00
parent 45606723ea
commit 5d31973be3
12 changed files with 370 additions and 8 deletions

View File

@@ -1,9 +1,40 @@
---
import "../styles/globals.css";
const { title = "Valtrix Struktur schafft Wert", description = "Cloud, Security & AI Consulting aus Berlin", path = "/" } = Astro.props;
// Language & routing helpers
const pathname = Astro.url.pathname;
const isEn = pathname.startsWith('/en');
const lang = isEn ? 'en' : 'de';
const prefix = isEn ? '/en' : '';
const stripEn = (p) => p.replace(/^\/en(?=\/|$)/, '');
const altHref = isEn ? (stripEn(pathname) || '/') : ('/en' + (pathname === '/' ? '' : pathname));
// Canonical/alternate URLs (use provided path when present for og/link tags)
const canonicalPath = path || pathname;
const deHref = stripEn(canonicalPath) || '/';
const enHref = canonicalPath.startsWith('/en') ? canonicalPath : ('/en' + (canonicalPath === '/' ? '' : canonicalPath));
// Nav labels per language
const labels = isEn ? {
services: 'Services',
security: 'Security',
cases: 'Case Studies',
about: 'About',
contact: 'Contact',
imprint: 'Imprint',
privacy: 'Privacy',
langShort: 'DE',
} : {
services: 'Leistungen',
security: 'Sicherheit',
cases: 'Referenzen',
about: 'Über uns',
contact: 'Kontakt',
imprint: 'Impressum',
privacy: 'Datenschutz',
langShort: 'EN',
};
---
<!doctype html>
<html lang="de" data-theme="dark">
<html lang={lang} data-theme="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -15,20 +46,23 @@ const { title = "Valtrix Struktur schafft Wert", description = "Cloud, Secur
<meta property="og:url" content={`https://valtrix.systems${path}`} />
<meta property="og:image" content="/og-image.png" />
<link rel="icon" type="image/png" href="/logo-valtrix.png" />
<link rel="alternate" hreflang="de" href={`https://valtrix.systems${deHref}`} />
<link rel="alternate" hreflang="en" href={`https://valtrix.systems${enHref}`} />
</head>
<body class="bg-white transition-colors duration-300">
<header class="max-w-7xl mx-auto px-6 py-6">
<nav class="flex items-center justify-between">
<a href="/" class="flex items-center gap-3 font-semibold">
<a href={`${prefix || '/'}`} class="flex items-center gap-3 font-semibold">
<img src="/logo-valtrix.png" alt="Valtrix" class="h-9 w-9 rounded-md shadow-sm"/>
<span class="tracking-wide text-lg">VALTRIX</span>
</a>
<div class="flex items-center gap-6">
<a href="/leistungen" class="text-textMuted hover:text-white">Leistungen</a>
<a href="/sicherheit" class="text-textMuted hover:text-white">Sicherheit</a>
<a href="/cases" class="text-textMuted hover:text-white">Referenzen</a>
<a href="/ueber-uns" class="text-textMuted hover:text-white">Über uns</a>
<a href="/kontakt" class="px-4 py-2 rounded-brand bg-primary text-white hover:opacity-90">Kontakt</a>
<a href={`${prefix}/leistungen`} class="text-textMuted hover:text-white">{labels.services}</a>
<a href={`${prefix}/sicherheit`} class="text-textMuted hover:text-white">{labels.security}</a>
<a href={`${prefix}/cases`} class="text-textMuted hover:text-white">{labels.cases}</a>
<a href={`${prefix}/ueber-uns`} class="text-textMuted hover:text-white">{labels.about}</a>
<a href={`${prefix}/kontakt`} class="px-4 py-2 rounded-brand bg-primary text-white hover:opacity-90">{labels.contact}</a>
<a href={altHref} class="px-3 py-2 border rounded-brand hover:bg-graybg" aria-label="Language switch">{labels.langShort}</a>
<button id="themeToggle" aria-label="Theme" class="px-3 py-2 border rounded-brand hover:bg-graybg">Light</button>
</div>
</nav>
@@ -40,7 +74,7 @@ const { title = "Valtrix Struktur schafft Wert", description = "Cloud, Secur
<div class="flex items-center gap-3 mb-3">
<strong>Valtrix</strong> · Precision. Power. Purpose.
</div>
© {new Date().getFullYear()} Valtrix · <a href="/impressum" class="underline">Impressum</a> · <a href="/datenschutz" class="underline">Datenschutz</a>
© {new Date().getFullYear()} Valtrix · <a href={`${prefix}/impressum`} class="underline">{labels.imprint}</a> · <a href={`${prefix}/datenschutz`} class="underline">{labels.privacy}</a>
</footer>
<script>
const btn = document.getElementById('themeToggle');