+
+
+ {dict.languageManager.title}
+
+
{dict.languageManager.hint}
+
+
+ {error && (
+
+ {error}
+
+ )}
+ {notice &&
{notice}
}
+
+
+
+
{dict.languageManager.title}
+
+
+
+ {loading ? (
+ {dict.common.loading}
+ ) : (
+
+ )}
+
+
+
+ {dict.languageManager.newLanguageTitle}
+
+
+
+ );
+}
diff --git a/components/i18n/LanguageSwitcher.tsx b/components/i18n/LanguageSwitcher.tsx
index 54037ff..8d0b443 100644
--- a/components/i18n/LanguageSwitcher.tsx
+++ b/components/i18n/LanguageSwitcher.tsx
@@ -2,9 +2,7 @@
import { useRouter } from "next/navigation";
import { useState } from "react";
-import { LOCALES, LOCALE_LABELS } from "@/lib/i18n/shared";
-import type { Locale } from "@/lib/i18n/shared";
-import { useLocale } from "@/components/i18n/LocaleProvider";
+import { useLanguages, useLocale } from "@/components/i18n/LocaleProvider";
export default function LanguageSwitcher({
className = "",
@@ -14,10 +12,11 @@ export default function LanguageSwitcher({
variant?: "dark" | "light";
}) {
const locale = useLocale();
+ const languages = useLanguages();
const router = useRouter();
const [busy, setBusy] = useState(false);
- async function change(next: Locale) {
+ async function change(next: string) {
if (next === locale || busy) return;
setBusy(true);
await fetch("/api/locale", {
@@ -29,6 +28,9 @@ export default function LanguageSwitcher({
setBusy(false);
}
+ // Bei nur einer aktiven Sprache gibt es nichts umzuschalten.
+ if (languages.length <= 1) return null;
+
const activeCls =
variant === "dark" ? "bg-white/25 text-white" : "bg-gray-200 text-gray-900";
const inactiveCls =
@@ -38,19 +40,19 @@ export default function LanguageSwitcher({
return (