Unify language system: one setting for all modules
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 41s
CI / test-go-edu-search (push) Successful in 30s
CI / test-python-klausur (push) Failing after 2m29s
CI / test-python-agent-core (push) Successful in 19s
CI / test-nodejs-website (push) Successful in 26s

- Merge two separate language systems (bp_language + bp_native_language) into one
- NativeLanguageContext now reads from LanguageContext (same localStorage key)
- Extend i18n.ts to 26 languages with flags (UI falls back to EN/DE)
- Replace LanguageSwitcher with LanguageDropdown (flags) in learn + parent layouts
- Migration: old bp_native_language value auto-migrates to bp_language
- Onboarding page writes to bp_language (unified key)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-29 16:54:27 +02:00
parent a30f10a467
commit 0018076ed5
6 changed files with 57 additions and 41 deletions

View File

@@ -2,16 +2,15 @@
import { Sidebar } from '@/components/Sidebar'
import { useTheme } from '@/lib/ThemeContext'
import { useNativeLanguage } from '@/lib/useNativeLanguage'
import { LanguageSwitcher } from '@/components/learn/LanguageSwitcher'
import { LanguageDropdown } from '@/components/LanguageDropdown'
/**
* Shared layout for ALL /learn/* pages.
* Provides: Sidebar + gradient background + language switcher.
* Provides: Sidebar + gradient background + language dropdown (flags).
* Uses the central LanguageContext (same as all other modules).
*/
export default function LearnLayout({ children }: { children: React.ReactNode }) {
const { isDark } = useTheme()
const { nativeLang, setNativeLang, isThirdLanguage } = useNativeLanguage()
return (
<div className={`min-h-screen flex relative overflow-hidden ${
@@ -23,13 +22,9 @@ export default function LearnLayout({ children }: { children: React.ReactNode })
<Sidebar />
</div>
<div className="flex-1 flex flex-col relative z-10 overflow-y-auto scrollbar-hide" style={{ scrollbarWidth: 'none' }}>
{/* Sticky language switcher at top-right */}
{/* Language dropdown at top-right (same as worksheet-editor etc.) */}
<div className="sticky top-0 z-20 flex justify-end px-4 py-2">
<LanguageSwitcher
currentLang={nativeLang}
onLangChange={setNativeLang}
isDark={isDark}
/>
<LanguageDropdown />
</div>
{children}
<div className="text-center py-4">