refactor: unify recipe routes into [recipeLang] slug with full bilingual support
Consolidate /rezepte and /recipes routes into single [recipeLang] structure to eliminate code duplication. All pages now use conditional API routing and reactive labels based on language parameter. - Merge duplicate route structures into /[recipeLang] with 404 for invalid slugs - Add English API endpoints for search, favorites, tags, and categories - Implement language dropdown in header with localStorage persistence - Convert all pages to use Svelte 5 runes (, , ) - Add German-only redirects (301) for add/edit pages - Make all view pages (list, detail, filters, search, favorites) fully bilingual - Remove floating language switcher in favor of header dropdown
This commit is contained in:
34
src/routes/[recipeLang]/+layout.svelte
Normal file
34
src/routes/[recipeLang]/+layout.svelte
Normal file
@@ -0,0 +1,34 @@
|
||||
<script>
|
||||
import Header from '$lib/components/Header.svelte'
|
||||
import UserHeader from '$lib/components/UserHeader.svelte';
|
||||
let { data } = $props();
|
||||
|
||||
let user = $derived(data.session?.user);
|
||||
|
||||
const isEnglish = $derived(data.lang === 'en');
|
||||
const labels = $derived({
|
||||
allRecipes: isEnglish ? 'All Recipes' : 'Alle Rezepte',
|
||||
favorites: isEnglish ? 'Favorites' : 'Favoriten',
|
||||
inSeason: isEnglish ? 'In Season' : 'In Saison',
|
||||
category: isEnglish ? 'Category' : 'Kategorie',
|
||||
icon: 'Icon',
|
||||
keywords: isEnglish ? 'Keywords' : 'Stichwörter',
|
||||
tips: isEnglish ? 'Tips' : 'Tipps'
|
||||
});
|
||||
</script>
|
||||
|
||||
<Header>
|
||||
<ul class=site_header slot=links>
|
||||
<li><a href="/{data.recipeLang}">{labels.allRecipes}</a></li>
|
||||
{#if user}
|
||||
<li><a href="/{data.recipeLang}/favorites">{labels.favorites}</a></li>
|
||||
{/if}
|
||||
<li><a href="/{data.recipeLang}/season">{labels.inSeason}</a></li>
|
||||
<li><a href="/{data.recipeLang}/category">{labels.category}</a></li>
|
||||
<li><a href="/{data.recipeLang}/icon">{labels.icon}</a></li>
|
||||
<li><a href="/{data.recipeLang}/tag">{labels.keywords}</a></li>
|
||||
<li><a href="/rezepte/tips-and-tricks">{labels.tips}</a></li>
|
||||
</ul>
|
||||
<UserHeader slot=right_side {user} showLanguageSelector={true}></UserHeader>
|
||||
<slot></slot>
|
||||
</Header>
|
||||
Reference in New Issue
Block a user