// i18n.jsx — 8 locales for inspirecipe
// UI chrome strings + a couple recipe headers. Recipe body stays English-canonical
// to keep file scope sane; this still demonstrates real localization architecture.

// LOCALES: short list with full UI translations (used by header/locale picker).
const LOCALES = [
  { code: 'en', name: 'English',    flag: 'EN', dir: 'ltr', region: 'Global' },
  { code: 'id', name: 'Indonesia',  flag: 'ID', dir: 'ltr', region: 'Asia' },
  { code: 'ja', name: '日本語',      flag: 'JA', dir: 'ltr', region: 'Asia' },
  { code: 'ko', name: '한국어',      flag: 'KO', dir: 'ltr', region: 'Asia' },
  { code: 'it', name: 'Italiano',   flag: 'IT', dir: 'ltr', region: 'Europe' },
  { code: 'fr', name: 'Français',   flag: 'FR', dir: 'ltr', region: 'Europe' },
  { code: 'de', name: 'Deutsch',    flag: 'DE', dir: 'ltr', region: 'Europe' },
  { code: 'es', name: 'Español',    flag: 'ES', dir: 'ltr', region: 'Americas' },
];

// LOCALES_ALL: ~80 major web languages for SEO subdirectory routing (/<code>/).
// Each gets hreflang + sitemap entry. Languages without translation strings
// fall back to English content but keep self-canonical URL.
const LOCALES_ALL = [
  { code: 'en',    name: 'English',           hreflang: 'en',    dir: 'ltr', region: 'Global' },
  { code: 'es',    name: 'Español',           hreflang: 'es',    dir: 'ltr', region: 'Americas' },
  { code: 'pt',    name: 'Português',         hreflang: 'pt',    dir: 'ltr', region: 'Americas' },
  { code: 'pt-br', name: 'Português (Brasil)',hreflang: 'pt-BR', dir: 'ltr', region: 'Americas' },
  { code: 'fr',    name: 'Français',          hreflang: 'fr',    dir: 'ltr', region: 'Europe' },
  { code: 'de',    name: 'Deutsch',           hreflang: 'de',    dir: 'ltr', region: 'Europe' },
  { code: 'it',    name: 'Italiano',          hreflang: 'it',    dir: 'ltr', region: 'Europe' },
  { code: 'nl',    name: 'Nederlands',        hreflang: 'nl',    dir: 'ltr', region: 'Europe' },
  { code: 'pl',    name: 'Polski',            hreflang: 'pl',    dir: 'ltr', region: 'Europe' },
  { code: 'ru',    name: 'Русский',           hreflang: 'ru',    dir: 'ltr', region: 'Europe' },
  { code: 'uk',    name: 'Українська',        hreflang: 'uk',    dir: 'ltr', region: 'Europe' },
  { code: 'cs',    name: 'Čeština',           hreflang: 'cs',    dir: 'ltr', region: 'Europe' },
  { code: 'sk',    name: 'Slovenčina',        hreflang: 'sk',    dir: 'ltr', region: 'Europe' },
  { code: 'hu',    name: 'Magyar',            hreflang: 'hu',    dir: 'ltr', region: 'Europe' },
  { code: 'ro',    name: 'Română',            hreflang: 'ro',    dir: 'ltr', region: 'Europe' },
  { code: 'bg',    name: 'Български',         hreflang: 'bg',    dir: 'ltr', region: 'Europe' },
  { code: 'sr',    name: 'Српски',            hreflang: 'sr',    dir: 'ltr', region: 'Europe' },
  { code: 'hr',    name: 'Hrvatski',          hreflang: 'hr',    dir: 'ltr', region: 'Europe' },
  { code: 'bs',    name: 'Bosanski',          hreflang: 'bs',    dir: 'ltr', region: 'Europe' },
  { code: 'sl',    name: 'Slovenščina',       hreflang: 'sl',    dir: 'ltr', region: 'Europe' },
  { code: 'mk',    name: 'Македонски',        hreflang: 'mk',    dir: 'ltr', region: 'Europe' },
  { code: 'sq',    name: 'Shqip',             hreflang: 'sq',    dir: 'ltr', region: 'Europe' },
  { code: 'el',    name: 'Ελληνικά',          hreflang: 'el',    dir: 'ltr', region: 'Europe' },
  { code: 'sv',    name: 'Svenska',           hreflang: 'sv',    dir: 'ltr', region: 'Europe' },
  { code: 'da',    name: 'Dansk',             hreflang: 'da',    dir: 'ltr', region: 'Europe' },
  { code: 'no',    name: 'Norsk',             hreflang: 'no',    dir: 'ltr', region: 'Europe' },
  { code: 'fi',    name: 'Suomi',             hreflang: 'fi',    dir: 'ltr', region: 'Europe' },
  { code: 'is',    name: 'Íslenska',          hreflang: 'is',    dir: 'ltr', region: 'Europe' },
  { code: 'et',    name: 'Eesti',             hreflang: 'et',    dir: 'ltr', region: 'Europe' },
  { code: 'lv',    name: 'Latviešu',          hreflang: 'lv',    dir: 'ltr', region: 'Europe' },
  { code: 'lt',    name: 'Lietuvių',          hreflang: 'lt',    dir: 'ltr', region: 'Europe' },
  { code: 'ga',    name: 'Gaeilge',           hreflang: 'ga',    dir: 'ltr', region: 'Europe' },
  { code: 'cy',    name: 'Cymraeg',           hreflang: 'cy',    dir: 'ltr', region: 'Europe' },
  { code: 'mt',    name: 'Malti',             hreflang: 'mt',    dir: 'ltr', region: 'Europe' },
  { code: 'ca',    name: 'Català',            hreflang: 'ca',    dir: 'ltr', region: 'Europe' },
  { code: 'eu',    name: 'Euskara',           hreflang: 'eu',    dir: 'ltr', region: 'Europe' },
  { code: 'gl',    name: 'Galego',            hreflang: 'gl',    dir: 'ltr', region: 'Europe' },
  { code: 'lb',    name: 'Lëtzebuergesch',    hreflang: 'lb',    dir: 'ltr', region: 'Europe' },
  { code: 'tr',    name: 'Türkçe',            hreflang: 'tr',    dir: 'ltr', region: 'Europe' },
  { code: 'az',    name: 'Azərbaycan',        hreflang: 'az',    dir: 'ltr', region: 'Asia' },
  { code: 'kk',    name: 'Қазақша',           hreflang: 'kk',    dir: 'ltr', region: 'Asia' },
  { code: 'uz',    name: 'Oʻzbek',            hreflang: 'uz',    dir: 'ltr', region: 'Asia' },
  { code: 'ky',    name: 'Кыргызча',          hreflang: 'ky',    dir: 'ltr', region: 'Asia' },
  { code: 'tg',    name: 'Тоҷикӣ',            hreflang: 'tg',    dir: 'ltr', region: 'Asia' },
  { code: 'mn',    name: 'Монгол',            hreflang: 'mn',    dir: 'ltr', region: 'Asia' },
  { code: 'hy',    name: 'Հայերեն',           hreflang: 'hy',    dir: 'ltr', region: 'Asia' },
  { code: 'ka',    name: 'ქართული',           hreflang: 'ka',    dir: 'ltr', region: 'Asia' },
  { code: 'ja',    name: '日本語',             hreflang: 'ja',    dir: 'ltr', region: 'Asia' },
  { code: 'ko',    name: '한국어',             hreflang: 'ko',    dir: 'ltr', region: 'Asia' },
  { code: 'zh',    name: '简体中文',           hreflang: 'zh-Hans', dir: 'ltr', region: 'Asia' },
  { code: 'zh-tw', name: '繁體中文',           hreflang: 'zh-Hant', dir: 'ltr', region: 'Asia' },
  { code: 'th',    name: 'ไทย',                hreflang: 'th',    dir: 'ltr', region: 'Asia' },
  { code: 'vi',    name: 'Tiếng Việt',        hreflang: 'vi',    dir: 'ltr', region: 'Asia' },
  { code: 'id',    name: 'Bahasa Indonesia',  hreflang: 'id',    dir: 'ltr', region: 'Asia' },
  { code: 'ms',    name: 'Bahasa Melayu',     hreflang: 'ms',    dir: 'ltr', region: 'Asia' },
  { code: 'fil',   name: 'Filipino',          hreflang: 'fil',   dir: 'ltr', region: 'Asia' },
  { code: 'my',    name: 'မြန်မာ',             hreflang: 'my',    dir: 'ltr', region: 'Asia' },
  { code: 'km',    name: 'ខ្មែរ',                hreflang: 'km',    dir: 'ltr', region: 'Asia' },
  { code: 'lo',    name: 'ລາວ',                 hreflang: 'lo',    dir: 'ltr', region: 'Asia' },
  { code: 'hi',    name: 'हिन्दी',             hreflang: 'hi',    dir: 'ltr', region: 'Asia' },
  { code: 'bn',    name: 'বাংলা',              hreflang: 'bn',    dir: 'ltr', region: 'Asia' },
  { code: 'ta',    name: 'தமிழ்',              hreflang: 'ta',    dir: 'ltr', region: 'Asia' },
  { code: 'te',    name: 'తెలుగు',            hreflang: 'te',    dir: 'ltr', region: 'Asia' },
  { code: 'mr',    name: 'मराठी',              hreflang: 'mr',    dir: 'ltr', region: 'Asia' },
  { code: 'gu',    name: 'ગુજરાતી',           hreflang: 'gu',    dir: 'ltr', region: 'Asia' },
  { code: 'kn',    name: 'ಕನ್ನಡ',              hreflang: 'kn',    dir: 'ltr', region: 'Asia' },
  { code: 'ml',    name: 'മലയാളം',            hreflang: 'ml',    dir: 'ltr', region: 'Asia' },
  { code: 'pa',    name: 'ਪੰਜਾਬੀ',             hreflang: 'pa',    dir: 'ltr', region: 'Asia' },
  { code: 'ne',    name: 'नेपाली',            hreflang: 'ne',    dir: 'ltr', region: 'Asia' },
  { code: 'si',    name: 'සිංහල',             hreflang: 'si',    dir: 'ltr', region: 'Asia' },
  { code: 'ur',    name: 'اردو',              hreflang: 'ur',    dir: 'rtl', region: 'Asia' },
  { code: 'fa',    name: 'فارسی',             hreflang: 'fa',    dir: 'rtl', region: 'Asia' },
  { code: 'ar',    name: 'العربية',           hreflang: 'ar',    dir: 'rtl', region: 'MENA' },
  { code: 'he',    name: 'עברית',             hreflang: 'he',    dir: 'rtl', region: 'MENA' },
  { code: 'sw',    name: 'Kiswahili',         hreflang: 'sw',    dir: 'ltr', region: 'Africa' },
  { code: 'am',    name: 'አማርኛ',              hreflang: 'am',    dir: 'ltr', region: 'Africa' },
  { code: 'yo',    name: 'Yorùbá',            hreflang: 'yo',    dir: 'ltr', region: 'Africa' },
  { code: 'ig',    name: 'Igbo',              hreflang: 'ig',    dir: 'ltr', region: 'Africa' },
  { code: 'ha',    name: 'Hausa',             hreflang: 'ha',    dir: 'ltr', region: 'Africa' },
  { code: 'zu',    name: 'isiZulu',           hreflang: 'zu',    dir: 'ltr', region: 'Africa' },
  { code: 'af',    name: 'Afrikaans',         hreflang: 'af',    dir: 'ltr', region: 'Africa' },
];

const LOCALE_CODES_ALL = LOCALES_ALL.map(l => l.code);
const LOCALE_BY_CODE   = Object.fromEntries(LOCALES_ALL.map(l => [l.code, l]));

const STRINGS = {
  en: {
    tagline: 'Recipes that respect your time.',
    nav_recipes: 'Recipes', nav_collections: 'Collections', nav_cuisines: 'Cuisines',
    nav_quick: 'Quick & Easy', nav_method: 'Methods', nav_about: 'About',
    search_ph: 'Search 8,420 tested recipes — “brown butter cookies”',
    jump_to_recipe: 'Jump to recipe', save: 'Save', share: 'Share', print: 'Print',
    serves: 'Serves', servings: 'Servings', prep: 'Prep', cook: 'Cook',
    total: 'Total', active: 'Active', rest: 'Rest', calories: 'Calories',
    difficulty: 'Difficulty', cuisine: 'Cuisine', diet: 'Diet',
    rating_count: (n) => `${n.toLocaleString()} ratings`,
    tested_by: 'Tested by', updated: 'Updated',
    quick_answer: 'Quick answer', read_in: 'A 30-second answer',
    ingredients: 'Ingredients', instructions: 'Method', notes: "Cook's notes",
    metric: 'Metric', imperial: 'US', minus: 'Decrease', plus: 'Increase',
    cook_mode: 'Cook mode', exit_cook: 'Exit', step: 'Step', of: 'of',
    next: 'Next', previous: 'Back', start_timer: 'Start timer',
    why_works: 'Why this recipe works', faq: 'Frequently asked',
    nutrition: 'Nutrition per serving', allergens: 'Allergens', subs: 'Substitutions',
    similar: 'You might also love', seasonal: 'In season now', trending: 'Trending this week',
    quick_dinners: '30-minute dinners', editors: 'Tested by our editors',
    weeknight: 'Weeknight', oneskillet: 'One skillet', baking: 'Baking',
    airfryer: 'Air fryer', vegetarian: 'Vegetarian', glutenfree: 'Gluten-free',
    newsletter_title: 'A weekly recipe, properly tested.',
    newsletter_sub: 'No content farm. No 1,200-word headnote. One excellent recipe, every Sunday.',
    email_ph: 'your@email.com', subscribe: 'Subscribe',
    footer_tag: 'Recipes that respect your time.',
    home_hero_title: 'Viral recipes. Validated by real cooks. Now in your language.',
    home_hero_sub: 'The world\'s viral dishes — every one tested in a real kitchen by named editors before it ever reaches your screen. Browse 8,420 recipes from 80 cultures, written for humans, structured for search and AI.',
    explore: 'Explore recipes', how_we_test: 'How we validate',
    world: 'Recipes of the world', world_sub: 'Browse by region — local techniques, local ingredients, tested by local cooks.',
    ai_title: 'Ask anything about cooking',
    ai_sub: 'Our AI Sous-Chef cites real, tested recipes — never invented ones.',
    minutes: 'min',
  },
  id: {
    tagline: 'Resep yang menghargai waktumu.',
    nav_recipes: 'Resep', nav_collections: 'Koleksi', nav_cuisines: 'Masakan',
    nav_quick: 'Cepat & Mudah', nav_method: 'Metode', nav_about: 'Tentang',
    search_ph: 'Cari 8.420 resep teruji — “nasi goreng kampung”',
    jump_to_recipe: 'Langsung ke resep', save: 'Simpan', share: 'Bagikan', print: 'Cetak',
    serves: 'Untuk', servings: 'Porsi', prep: 'Persiapan', cook: 'Memasak',
    total: 'Total', active: 'Aktif', rest: 'Istirahat', calories: 'Kalori',
    difficulty: 'Kesulitan', cuisine: 'Masakan', diet: 'Diet',
    rating_count: (n) => `${n.toLocaleString('id-ID')} ulasan`,
    tested_by: 'Diuji oleh', updated: 'Diperbarui',
    quick_answer: 'Jawaban singkat', read_in: 'Jawaban 30 detik',
    ingredients: 'Bahan', instructions: 'Cara membuat', notes: 'Catatan koki',
    metric: 'Metrik', imperial: 'US', minus: 'Kurangi', plus: 'Tambah',
    cook_mode: 'Mode masak', exit_cook: 'Keluar', step: 'Langkah', of: 'dari',
    next: 'Lanjut', previous: 'Kembali', start_timer: 'Mulai pengatur waktu',
    why_works: 'Kenapa resep ini berhasil', faq: 'Pertanyaan umum',
    nutrition: 'Nutrisi per porsi', allergens: 'Alergen', subs: 'Pengganti bahan',
    similar: 'Mungkin kamu juga suka', seasonal: 'Musim ini', trending: 'Populer pekan ini',
    quick_dinners: 'Makan malam 30 menit', editors: 'Diuji editor kami',
    weeknight: 'Hari kerja', oneskillet: 'Satu wajan', baking: 'Memanggang',
    airfryer: 'Air fryer', vegetarian: 'Vegetarian', glutenfree: 'Bebas gluten',
    newsletter_title: 'Satu resep tiap minggu, teruji rapi.',
    newsletter_sub: 'Bukan situs konten massal. Bukan cerita 1.200 kata. Satu resep terbaik, setiap Minggu.',
    email_ph: 'email@kamu.com', subscribe: 'Berlangganan',
    footer_tag: 'Resep yang menghargai waktumu.',
    home_hero_title: 'Resep viral dunia. Tervalidasi koki sungguhan. Kini dalam bahasamu.',
    home_hero_sub: 'Hidangan viral dari seluruh dunia — setiap resep diuji di dapur sungguhan oleh editor bernama sebelum tayang. 8.420 resep dari 80 budaya, ditulis untuk manusia, terstruktur untuk pencarian dan AI.',
    explore: 'Telusuri resep', how_we_test: 'Cara kami memvalidasi',
    world: 'Resep dari seluruh dunia', world_sub: 'Telusuri per kawasan — teknik lokal, bahan lokal, diuji oleh koki lokal.',
    ai_title: 'Tanya apa pun soal memasak',
    ai_sub: 'AI Sous-Chef kami mengutip resep nyata yang sudah diuji — tidak pernah mengarang.',
    minutes: 'mnt',
  },
  ja: {
    tagline: '時間を大切にするレシピ。',
    nav_recipes: 'レシピ', nav_collections: '特集', nav_cuisines: '料理ジャンル',
    nav_quick: '時短', nav_method: '調理法', nav_about: '私たちについて',
    search_ph: '8,420件の検証済みレシピを検索 — 「ブラウンバタークッキー」',
    jump_to_recipe: 'レシピへ移動', save: '保存', share: '共有', print: '印刷',
    serves: '人分', servings: '人分', prep: '下準備', cook: '加熱',
    total: '合計', active: '実作業', rest: '休ませる', calories: 'カロリー',
    difficulty: '難易度', cuisine: 'ジャンル', diet: '食事制限',
    rating_count: (n) => `${n.toLocaleString('ja-JP')}件の評価`,
    tested_by: '検証者', updated: '更新日',
    quick_answer: 'クイック回答', read_in: '30秒でわかる答え',
    ingredients: '材料', instructions: '作り方', notes: 'コツとメモ',
    metric: 'メートル法', imperial: '米国式', minus: '減らす', plus: '増やす',
    cook_mode: '調理モード', exit_cook: '終了', step: 'ステップ', of: '/',
    next: '次へ', previous: '戻る', start_timer: 'タイマー開始',
    why_works: 'このレシピが成功する理由', faq: 'よくある質問',
    nutrition: '1人分の栄養', allergens: 'アレルゲン', subs: '代用品',
    similar: 'こちらもおすすめ', seasonal: '今が旬', trending: '今週の人気',
    quick_dinners: '30分でできる夕食', editors: '編集部の検証済み',
    weeknight: '平日', oneskillet: 'ワンパン', baking: '焼き菓子',
    airfryer: 'エアフライヤー', vegetarian: 'ベジタリアン', glutenfree: 'グルテンフリー',
    newsletter_title: '毎週一つ、丁寧に検証したレシピを。',
    newsletter_sub: 'コンテンツファームではありません。長い前置きもありません。毎週日曜、最高のレシピを一つだけ。',
    email_ph: 'your@email.com', subscribe: '購読する',
    footer_tag: '時間を大切にするレシピ。',
    home_hero_title: '自信を持って料理する。',
    home_hero_sub: '新しいレシピサイト — 実際の厨房で検証し、人間のために書き、AIにも見つけやすい構造。',
    explore: 'レシピを探す', how_we_test: '検証方法',
    world: '世界のレシピ', world_sub: '地域ごとに巡る — 現地の技、現地の食材、現地の料理人が検証。',
    ai_title: '料理について何でも質問',
    ai_sub: 'AIスーシェフは実在する検証済みレシピだけを引用します — 想像で答えません。',
    minutes: '分',
  },
  ko: {
    tagline: '당신의 시간을 존중하는 레시피.',
    nav_recipes: '레시피', nav_collections: '컬렉션', nav_cuisines: '요리',
    nav_quick: '빠르고 쉬운', nav_method: '조리법', nav_about: '소개',
    search_ph: '8,420개의 검증된 레시피 검색 — “브라운 버터 쿠키”',
    jump_to_recipe: '레시피로 이동', save: '저장', share: '공유', print: '인쇄',
    serves: '인분', servings: '인분', prep: '준비', cook: '조리',
    total: '총', active: '실작업', rest: '휴지', calories: '칼로리',
    difficulty: '난이도', cuisine: '요리', diet: '식이',
    rating_count: (n) => `${n.toLocaleString('ko-KR')}개의 평점`,
    tested_by: '검증', updated: '업데이트',
    quick_answer: '빠른 답변', read_in: '30초 요약',
    ingredients: '재료', instructions: '만드는 법', notes: '쉐프 노트',
    metric: '미터법', imperial: '미국식', minus: '감소', plus: '증가',
    cook_mode: '쿡 모드', exit_cook: '종료', step: '단계', of: '/',
    next: '다음', previous: '이전', start_timer: '타이머 시작',
    why_works: '이 레시피가 성공하는 이유', faq: '자주 묻는 질문',
    nutrition: '1인분 영양', allergens: '알레르겐', subs: '대체 재료',
    similar: '이런 레시피도 좋아할 거예요', seasonal: '제철', trending: '이번 주 인기',
    quick_dinners: '30분 저녁', editors: '에디터 검증',
    weeknight: '평일', oneskillet: '원팬', baking: '베이킹',
    airfryer: '에어프라이어', vegetarian: '베지테리언', glutenfree: '글루텐 프리',
    newsletter_title: '매주 한 가지, 제대로 검증된 레시피.',
    newsletter_sub: '콘텐츠 농장이 아닙니다. 긴 서두도 없습니다. 매주 일요일, 단 하나의 훌륭한 레시피.',
    email_ph: 'your@email.com', subscribe: '구독하기',
    footer_tag: '당신의 시간을 존중하는 레시피.',
    home_hero_title: '자신 있게 요리하세요.',
    home_hero_sub: '새로운 종류의 레시피 사이트 — 실제 주방에서 검증, 사람을 위해 쓰고, AI와 검색이 쉽게 찾도록 구조화.',
    explore: '레시피 둘러보기', how_we_test: '검증 방식',
    world: '세계의 레시피', world_sub: '지역별로 — 현지 기법, 현지 재료, 현지 요리사가 검증.',
    ai_title: '요리에 대해 무엇이든 물어보세요',
    ai_sub: 'AI 수셰프는 실제 검증된 레시피만 인용합니다 — 절대 만들어내지 않습니다.',
    minutes: '분',
  },
  it: {
    tagline: 'Ricette che rispettano il tuo tempo.',
    nav_recipes: 'Ricette', nav_collections: 'Raccolte', nav_cuisines: 'Cucine',
    nav_quick: 'Veloci', nav_method: 'Metodi', nav_about: 'Chi siamo',
    search_ph: 'Cerca tra 8.420 ricette testate — “biscotti al burro nocciola”',
    jump_to_recipe: 'Vai alla ricetta', save: 'Salva', share: 'Condividi', print: 'Stampa',
    serves: 'Per', servings: 'Porzioni', prep: 'Prep.', cook: 'Cottura',
    total: 'Totale', active: 'Attivo', rest: 'Riposo', calories: 'Calorie',
    difficulty: 'Difficoltà', cuisine: 'Cucina', diet: 'Dieta',
    rating_count: (n) => `${n.toLocaleString('it-IT')} valutazioni`,
    tested_by: 'Testata da', updated: 'Aggiornata',
    quick_answer: 'Risposta veloce', read_in: 'Risposta in 30 secondi',
    ingredients: 'Ingredienti', instructions: 'Procedimento', notes: 'Note dello chef',
    metric: 'Metrico', imperial: 'USA', minus: 'Diminuisci', plus: 'Aumenta',
    cook_mode: 'Modalità cucina', exit_cook: 'Esci', step: 'Passo', of: 'di',
    next: 'Avanti', previous: 'Indietro', start_timer: 'Avvia timer',
    why_works: 'Perché questa ricetta funziona', faq: 'Domande frequenti',
    nutrition: 'Valori nutrizionali per porzione', allergens: 'Allergeni', subs: 'Sostituzioni',
    similar: 'Potrebbero piacerti', seasonal: 'Di stagione', trending: 'Di tendenza',
    quick_dinners: 'Cene in 30 minuti', editors: 'Testate dai nostri editor',
    weeknight: 'Infrasettimanale', oneskillet: 'Una padella', baking: 'Forno',
    airfryer: 'Friggitrice ad aria', vegetarian: 'Vegetariano', glutenfree: 'Senza glutine',
    newsletter_title: 'Una ricetta a settimana, davvero testata.',
    newsletter_sub: 'Niente content farm. Niente preamboli. Una ricetta eccellente ogni domenica.',
    email_ph: 'tua@email.com', subscribe: 'Iscriviti',
    footer_tag: 'Ricette che rispettano il tuo tempo.',
    home_hero_title: 'Cucina con sicurezza.',
    home_hero_sub: 'Un nuovo modo di leggere le ricette — testate in cucina vera, scritte per le persone, strutturate per essere trovate da motori di ricerca e AI.',
    explore: 'Esplora le ricette', how_we_test: 'Come testiamo',
    world: 'Ricette dal mondo', world_sub: 'Sfoglia per regione — tecniche locali, ingredienti locali, testate da cuochi locali.',
    ai_title: 'Chiedi qualsiasi cosa di cucina',
    ai_sub: 'Il nostro AI Sous-Chef cita solo ricette reali e testate — mai inventate.',
    minutes: 'min',
  },
  fr: {
    tagline: 'Des recettes qui respectent votre temps.',
    nav_recipes: 'Recettes', nav_collections: 'Collections', nav_cuisines: 'Cuisines',
    nav_quick: 'Rapide', nav_method: 'Méthodes', nav_about: 'À propos',
    search_ph: 'Chercher parmi 8 420 recettes testées — « cookies beurre noisette »',
    jump_to_recipe: 'Aller à la recette', save: 'Enregistrer', share: 'Partager', print: 'Imprimer',
    serves: 'Pour', servings: 'Portions', prep: 'Prép.', cook: 'Cuisson',
    total: 'Total', active: 'Actif', rest: 'Repos', calories: 'Calories',
    difficulty: 'Difficulté', cuisine: 'Cuisine', diet: 'Régime',
    rating_count: (n) => `${n.toLocaleString('fr-FR')} avis`,
    tested_by: 'Testée par', updated: 'Mise à jour',
    quick_answer: 'Réponse rapide', read_in: 'Une réponse en 30 secondes',
    ingredients: 'Ingrédients', instructions: 'Préparation', notes: 'Notes du chef',
    metric: 'Métrique', imperial: 'US', minus: 'Diminuer', plus: 'Augmenter',
    cook_mode: 'Mode cuisine', exit_cook: 'Quitter', step: 'Étape', of: 'sur',
    next: 'Suivant', previous: 'Précédent', start_timer: 'Démarrer le minuteur',
    why_works: 'Pourquoi cette recette fonctionne', faq: 'Questions fréquentes',
    nutrition: 'Nutrition par portion', allergens: 'Allergènes', subs: 'Substitutions',
    similar: 'Vous pourriez aimer', seasonal: 'De saison', trending: 'Tendance',
    quick_dinners: 'Dîners en 30 minutes', editors: 'Testées par nos éditeurs',
    weeknight: 'Semaine', oneskillet: 'Une poêle', baking: 'Pâtisserie',
    airfryer: 'Friteuse à air', vegetarian: 'Végétarien', glutenfree: 'Sans gluten',
    newsletter_title: 'Une recette par semaine, vraiment testée.',
    newsletter_sub: 'Pas de content farm. Pas de prologue de 1 200 mots. Une excellente recette, chaque dimanche.',
    email_ph: 'votre@email.com', subscribe: "S'abonner",
    footer_tag: 'Des recettes qui respectent votre temps.',
    home_hero_title: 'Cuisinez en confiance.',
    home_hero_sub: 'Un nouveau type de site de recettes — chaque plat testé dans une vraie cuisine, écrit pour des humains, structuré pour la recherche et l’IA.',
    explore: 'Explorer les recettes', how_we_test: 'Notre méthode',
    world: 'Recettes du monde', world_sub: 'Par région — techniques locales, ingrédients locaux, testées par des cuisiniers locaux.',
    ai_title: 'Posez n’importe quelle question de cuisine',
    ai_sub: 'Notre AI Sous-Chef cite uniquement de vraies recettes testées — jamais inventées.',
    minutes: 'min',
  },
  de: {
    tagline: 'Rezepte, die deine Zeit respektieren.',
    nav_recipes: 'Rezepte', nav_collections: 'Kollektionen', nav_cuisines: 'Küchen',
    nav_quick: 'Schnell', nav_method: 'Methoden', nav_about: 'Über uns',
    search_ph: 'Suche unter 8.420 getesteten Rezepten — „Brown-Butter-Cookies“',
    jump_to_recipe: 'Zum Rezept', save: 'Speichern', share: 'Teilen', print: 'Drucken',
    serves: 'Für', servings: 'Portionen', prep: 'Vorber.', cook: 'Garen',
    total: 'Gesamt', active: 'Aktiv', rest: 'Ruhen', calories: 'Kalorien',
    difficulty: 'Schwierigkeit', cuisine: 'Küche', diet: 'Ernährung',
    rating_count: (n) => `${n.toLocaleString('de-DE')} Bewertungen`,
    tested_by: 'Getestet von', updated: 'Aktualisiert',
    quick_answer: 'Schnelle Antwort', read_in: '30-Sekunden-Antwort',
    ingredients: 'Zutaten', instructions: 'Zubereitung', notes: 'Tipps vom Koch',
    metric: 'Metrisch', imperial: 'US', minus: 'Weniger', plus: 'Mehr',
    cook_mode: 'Kochmodus', exit_cook: 'Beenden', step: 'Schritt', of: 'von',
    next: 'Weiter', previous: 'Zurück', start_timer: 'Timer starten',
    why_works: 'Warum dieses Rezept gelingt', faq: 'Häufige Fragen',
    nutrition: 'Nährwerte pro Portion', allergens: 'Allergene', subs: 'Alternativen',
    similar: 'Könnte dir auch gefallen', seasonal: 'Saisonal', trending: 'Im Trend',
    quick_dinners: '30-Minuten-Abendessen', editors: 'Von Editoren getestet',
    weeknight: 'Wochentag', oneskillet: 'Eine Pfanne', baking: 'Backen',
    airfryer: 'Heißluftfritteuse', vegetarian: 'Vegetarisch', glutenfree: 'Glutenfrei',
    newsletter_title: 'Ein Rezept pro Woche — richtig getestet.',
    newsletter_sub: 'Keine Content-Farm. Kein 1.200-Wörter-Vorwort. Jeden Sonntag ein hervorragendes Rezept.',
    email_ph: 'deine@email.com', subscribe: 'Abonnieren',
    footer_tag: 'Rezepte, die deine Zeit respektieren.',
    home_hero_title: 'Mit Selbstvertrauen kochen.',
    home_hero_sub: 'Eine neue Art Rezeptseite — jedes Gericht in echter Küche getestet, für Menschen geschrieben, für Suche und KI strukturiert.',
    explore: 'Rezepte entdecken', how_we_test: 'So testen wir',
    world: 'Rezepte der Welt', world_sub: 'Nach Region — lokale Techniken, lokale Zutaten, von lokalen Köchen getestet.',
    ai_title: 'Frag uns alles übers Kochen',
    ai_sub: 'Unser AI-Sous-Chef zitiert nur echte, getestete Rezepte — niemals erfundene.',
    minutes: 'Min.',
  },
  es: {
    tagline: 'Recetas que respetan tu tiempo.',
    nav_recipes: 'Recetas', nav_collections: 'Colecciones', nav_cuisines: 'Cocinas',
    nav_quick: 'Rápidas', nav_method: 'Métodos', nav_about: 'Sobre nosotros',
    search_ph: 'Busca entre 8.420 recetas probadas — «cookies de mantequilla tostada»',
    jump_to_recipe: 'Ir a la receta', save: 'Guardar', share: 'Compartir', print: 'Imprimir',
    serves: 'Para', servings: 'Porciones', prep: 'Prep.', cook: 'Cocción',
    total: 'Total', active: 'Activo', rest: 'Reposo', calories: 'Calorías',
    difficulty: 'Dificultad', cuisine: 'Cocina', diet: 'Dieta',
    rating_count: (n) => `${n.toLocaleString('es-ES')} valoraciones`,
    tested_by: 'Probada por', updated: 'Actualizada',
    quick_answer: 'Respuesta rápida', read_in: 'Una respuesta en 30 segundos',
    ingredients: 'Ingredientes', instructions: 'Elaboración', notes: 'Notas del chef',
    metric: 'Métrico', imperial: 'EE. UU.', minus: 'Reducir', plus: 'Aumentar',
    cook_mode: 'Modo cocina', exit_cook: 'Salir', step: 'Paso', of: 'de',
    next: 'Siguiente', previous: 'Anterior', start_timer: 'Iniciar temporizador',
    why_works: 'Por qué funciona esta receta', faq: 'Preguntas frecuentes',
    nutrition: 'Nutrición por porción', allergens: 'Alérgenos', subs: 'Sustituciones',
    similar: 'También podría gustarte', seasonal: 'De temporada', trending: 'En tendencia',
    quick_dinners: 'Cenas de 30 minutos', editors: 'Probadas por nuestros editores',
    weeknight: 'Entre semana', oneskillet: 'Una sartén', baking: 'Horneado',
    airfryer: 'Freidora de aire', vegetarian: 'Vegetariano', glutenfree: 'Sin gluten',
    newsletter_title: 'Una receta a la semana, bien probada.',
    newsletter_sub: 'Sin content farm. Sin prólogo de 1.200 palabras. Una excelente receta cada domingo.',
    email_ph: 'tu@email.com', subscribe: 'Suscribirse',
    footer_tag: 'Recetas que respetan tu tiempo.',
    home_hero_title: 'Cocina con confianza.',
    home_hero_sub: 'Un nuevo tipo de sitio de recetas — cada plato probado en una cocina real, escrito para humanos, estructurado para que la búsqueda y la IA lo encuentren.',
    explore: 'Explorar recetas', how_we_test: 'Cómo probamos',
    world: 'Recetas del mundo', world_sub: 'Navega por región — técnicas locales, ingredientes locales, probadas por cocineros locales.',
    ai_title: 'Pregunta lo que sea sobre cocina',
    ai_sub: 'Nuestro AI Sous-Chef cita solo recetas reales y probadas — nunca inventadas.',
    minutes: 'min',
  },
};

function t(locale, key, ...args) {
  const dict = STRINGS[locale] || STRINGS.en;
  const v = dict[key] ?? STRINGS.en[key] ?? key;
  return typeof v === 'function' ? v(...args) : v;
}

Object.assign(window, { LOCALES, LOCALES_ALL, LOCALE_CODES_ALL, LOCALE_BY_CODE, STRINGS, t });
