// content-i18n.jsx
// Localized dynamic content for articles, FAQ, and government programs.
(function () {
  const PROGRAMS = {
    en: {
      rkm: {
        name: "Family Housing Loan",
        short: "State subsidy from BGK for family mortgage payments.",
        benefit: "up to 600 PLN/month for 10 years",
        eligible: "Married couples and single parents. No other residential property.",
      },
      kfw: {
        name: "KfW Home Ownership Program",
        short: "Low-interest loan for first home purchase in Germany.",
        benefit: "up to EUR 100,000 for 25 years",
        eligible: "German residents buying their first owner-occupied property.",
      },
      ptz: {
        name: "Pret a Taux Zero (PTZ)",
        short: "Interest-free support loan for first home purchase in France.",
        benefit: "0% interest, up to 40% of property value",
        eligible: "First-time buyers meeting income limits.",
      },
      pierwsze: {
        name: "Housing Savings Account Bonus",
        short: "State premium for regular savings dedicated to housing goals.",
        benefit: "up to 15% annual premium",
        eligible: "People up to 45 years old without residential ownership.",
      },
      csok: {
        name: "CSOK Plus",
        short: "Subsidized housing loan for families in Hungary.",
        benefit: "fixed 3% rate up to 50M HUF",
        eligible: "Married couples with children or planning children.",
      },
      kapital: {
        name: "Safe Mortgage 2%",
        short: "Successor to BK 2% with fixed-rate subsidy period.",
        benefit: "2% fixed support for 10 years",
        eligible: "First-home buyers up to 35 years old.",
      },
    },
    de: {
      rkm: {
        name: "Familien Wohnkredit",
        short: "BGK-Zuschuss zu Hypothekenraten fuer Familien.",
        benefit: "bis zu 600 PLN/Monat fuer 10 Jahre",
        eligible: "Ehepaare und Alleinerziehende ohne weitere Wohnimmobilie.",
      },
      kfw: {
        name: "KfW Wohneigentumsprogramm",
        short: "Guenstiger Kredit fuer die erste Wohnung in Deutschland.",
        benefit: "bis zu 100.000 EUR fuer 25 Jahre",
        eligible: "In DE ansaessige Erstkaeufer zur Eigennutzung.",
      },
      ptz: {
        name: "Pret a Taux Zero (PTZ)",
        short: "Zinsfreier Kredit fuer den ersten Immobilienkauf in Frankreich.",
        benefit: "0% Zinsen, bis 40% des Kaufwerts",
        eligible: "Erstkaeufer mit Einkommensgrenzen.",
      },
      pierwsze: {
        name: "Wohnkonto Bonus",
        short: "Staatliche Praemie fuer regelmaessiges Wohnungssparen.",
        benefit: "bis 15% Sparpraemie",
        eligible: "Personen bis 45 ohne eigene Wohnimmobilie.",
      },
      csok: {
        name: "CSOK Plus",
        short: "Subventionierter Wohnkredit fuer Familien in Ungarn.",
        benefit: "fester Satz 3% bis 50 Mio. HUF",
        eligible: "Ehepaare mit Kindern oder Kinderplanung.",
      },
      kapital: {
        name: "Sicherer Kredit 2%",
        short: "Nachfolger von BK 2% mit staatlicher Ratenstuetze.",
        benefit: "2% Unterstuetzung fuer 10 Jahre",
        eligible: "Erstkaeufer bis 35 Jahre.",
      },
    },
    fr: {
      rkm: {
        name: "Credit Logement Familial",
        short: "Subvention BGK sur les mensualites de pret immobilier familial.",
        benefit: "jusqu a 600 PLN/mois pendant 10 ans",
        eligible: "Couples maries et parents seuls sans autre logement.",
      },
      kfw: {
        name: "Programme KfW Proprietaires",
        short: "Pret a taux reduit pour premier achat immobilier en Allemagne.",
        benefit: "jusqu a 100 000 EUR sur 25 ans",
        eligible: "Residents allemands achetant leur premier logement principal.",
      },
      ptz: {
        name: "Pret a Taux Zero (PTZ)",
        short: "Pret sans interets pour un premier achat en France.",
        benefit: "0% interets, jusqu a 40% de la valeur",
        eligible: "Primo-accedants sous plafond de revenus.",
      },
      pierwsze: {
        name: "Compte Epargne Logement Prime",
        short: "Prime publique pour epargne reguliere en vue d un logement.",
        benefit: "jusqu a 15% de prime annuelle",
        eligible: "Moins de 45 ans sans bien immobilier.",
      },
      csok: {
        name: "CSOK Plus",
        short: "Pret logement subventionne pour familles en Hongrie.",
        benefit: "taux fixe 3% jusqu a 50 M HUF",
        eligible: "Couples maries avec enfants ou projet d enfant.",
      },
      kapital: {
        name: "Pret Securise 2%",
        short: "Successeur du BK 2% avec soutien des mensualites.",
        benefit: "soutien a 2% pendant 10 ans",
        eligible: "Primo-accedants jusqu a 35 ans.",
      },
    },
    cs: {
      rkm: {
        name: "Rodinny bydleni uver",
        short: "Statni prispevek BGK na hypotecni splatky pro rodiny.",
        benefit: "az 600 PLN mesicne po dobu 10 let",
        eligible: "Manzele a samoživitele bez dalsi nemovitosti.",
      },
      kfw: {
        name: "KfW Program vlastniho bydleni",
        short: "Nizkourokovy uver na prvni bydleni v Nemecku.",
        benefit: "az 100 000 EUR na 25 let",
        eligible: "Rezidenti DE kupujici prvni vlastni bydleni.",
      },
      ptz: {
        name: "Pret a Taux Zero (PTZ)",
        short: "Bezurocny podporny uver na prvni bydleni ve Francii.",
        benefit: "0% uroku, az 40% hodnoty nemovitosti",
        eligible: "Prvokupci v prijmovych limitech.",
      },
      pierwsze: {
        name: "Bydleni ucet bonus",
        short: "Statni bonus za pravidelne sporeni na bydleni.",
        benefit: "az 15% rocni bonus",
        eligible: "Lide do 45 let bez vlastni nemovitosti.",
      },
      csok: {
        name: "CSOK Plus",
        short: "Dotovany uver na bydleni pro rodiny v Madarsku.",
        benefit: "fixni sazba 3% do 50 mil. HUF",
        eligible: "Manzele s detmi nebo planujici deti.",
      },
      kapital: {
        name: "Bezpecny uver 2%",
        short: "Nastupce BK 2% se statnim prispevkem na splatky.",
        benefit: "2% podpora po dobu 10 let",
        eligible: "Prvokupci do 35 let.",
      },
    },
    hu: {
      rkm: {
        name: "Csaladi lakashitel",
        short: "BGK tamogatas csaladi jelzaloghitel torleszteshez.",
        benefit: "akar 600 PLN/honap 10 even at",
        eligible: "Hazasparok es egyedulallo szulok masik ingatlan nelkul.",
      },
      kfw: {
        name: "KfW sajat otthon program",
        short: "Alacsony kamatozasu hitel elso nemetorszagi lakashoz.",
        benefit: "akar 100 000 EUR 25 evre",
        eligible: "Nemet rezidensek elso sajat celu ingatlanvasarlashoz.",
      },
      ptz: {
        name: "Pret a Taux Zero (PTZ)",
        short: "Kamatmentes tamogato hitel elso francia lakashoz.",
        benefit: "0% kamat, az ingatlan ertekenek 40%-aig",
        eligible: "Elso lakasvasarlok jovedelmi korlattal.",
      },
      pierwsze: {
        name: "Lakas megtakaritasi bonusz",
        short: "Allami premium rendszeres lakascelu megtakaritashoz.",
        benefit: "akar 15% eves bonusz",
        eligible: "45 ev alatti, sajat ingatlannal nem rendelkezo szemelyek.",
      },
      csok: {
        name: "CSOK Plusz",
        short: "Tamogatott csaladi lakashitel Magyarorszagon.",
        benefit: "fix 3% kamat 50 millio HUF-ig",
        eligible: "Gyermekes vagy gyermeket tervezo hazasparok.",
      },
      kapital: {
        name: "Biztonsagos hitel 2%",
        short: "A BK 2% utodja allami torlesztestamogatassal.",
        benefit: "2% tamogatas 10 evig",
        eligible: "Elso lakasvasarlok 35 ev alatt.",
      },
    },
    nl: {
      rkm: {
        name: "Familie woonkrediet",
        short: "BGK-subsidie op hypotheektermijnen voor gezinnen.",
        benefit: "tot 600 PLN per maand gedurende 10 jaar",
        eligible: "Getrouwde koppels en alleenstaande ouders zonder andere woning.",
      },
      kfw: {
        name: "KfW Eigen Woning Programma",
        short: "Lage rente lening voor eerste woning in Duitsland.",
        benefit: "tot EUR 100.000 voor 25 jaar",
        eligible: "Duitse inwoners die hun eerste eigen woning kopen.",
      },
      ptz: {
        name: "Pret a Taux Zero (PTZ)",
        short: "Renteloze steunlening voor eerste woning in Frankrijk.",
        benefit: "0% rente, tot 40% van de woningwaarde",
        eligible: "Starters met inkomensgrenzen.",
      },
      pierwsze: {
        name: "Woonspaarrekening Bonus",
        short: "Overheidspremie voor regelmatig sparen voor wonen.",
        benefit: "tot 15% jaarlijkse premie",
        eligible: "Tot 45 jaar en geen eigen woning.",
      },
      csok: {
        name: "CSOK Plus",
        short: "Gesubsidieerde woonlening voor gezinnen in Hongarije.",
        benefit: "vaste 3% rente tot 50 mln HUF",
        eligible: "Getrouwde koppels met kinderen of kinderwens.",
      },
      kapital: {
        name: "Veilige Lening 2%",
        short: "Opvolger van BK 2% met termijnsubsidie.",
        benefit: "2% steun voor 10 jaar",
        eligible: "Starter-kopers tot 35 jaar.",
      },
    },
  };

  const ARTICLES = {
    en: {
      1: {
        title: "WIBOR Is Falling - Should You Recalculate Your Loan Payment Now?",
        cat: "Mortgage",
        excerpt: "WIBOR 3M is stabilizing near 5.86%. We explain what it means for borrowers and when recalculation pays off.",
        tag: "Analysis",
      },
      2: {
        title: "Mortgage in EUR or PLN - What Is Better in 2026?",
        cat: "EUR Loan",
        excerpt: "Rate spread is still above 3pp. Lower interest can help, but FX risk remains very real.",
        tag: "Guide",
      },
      3: {
        title: "Family Housing Loan 2026 - Who Qualifies?",
        cat: "Government Programs",
        excerpt: "Latest subsidy rules, thresholds, and practical steps to apply without missing required documents.",
        tag: "Programs",
      },
      4: {
        title: "Credit Score - 7 Things That Truly Improve It",
        cat: "Personal Finance",
        excerpt: "Banks check history before each decision. We separate myths from factors that actually move your score.",
        tag: "BIK",
      },
      5: {
        title: "APR vs Nominal Rate - Where Loan Costs Hide",
        cat: "Guide",
        excerpt: "We compare real offers and show why the lowest headline rate is often not the cheapest loan.",
        tag: "Guide",
      },
      6: {
        title: "Debt Consolidation Loan - When It Really Makes Sense",
        cat: "Cash Loan",
        excerpt: "Consolidation is not always cheaper. We show cases where longer tenor can hurt your total cost.",
        tag: "Analysis",
      },
    },
    de: {
      1: { title: "WIBOR faellt - Lohnt sich jetzt eine Raten-Neuberechnung?", cat: "Hypothek", excerpt: "WIBOR 3M liegt bei 5,86%. Wir zeigen, wann eine Neuberechnung sinnvoll ist.", tag: "Analyse" },
      2: { title: "Hypothek in EUR oder PLN - Was ist 2026 besser?", cat: "EUR-Kredit", excerpt: "Der Zinsabstand ist hoch, aber das Wechselkursrisiko bleibt entscheidend.", tag: "Leitfaden" },
      3: { title: "Familien-Wohnkredit 2026 - Wer ist berechtigt?", cat: "Foerderprogramme", excerpt: "Aktuelle Bedingungen, Einkommensgrenzen und ein klarer Antragsablauf.", tag: "Programme" },
      4: { title: "Bonitaet - 7 Punkte, die den Score wirklich verbessern", cat: "Persoenliche Finanzen", excerpt: "Was Banken wirklich bewerten und welche Mythen Sie ignorieren koennen.", tag: "BIK" },
      5: { title: "Effektivzins vs. Nominalzins - Versteckte Kosten erkennen", cat: "Leitfaden", excerpt: "Warum ein niedriger Nominalzins nicht automatisch den guenstigsten Kredit bedeutet.", tag: "Leitfaden" },
      6: { title: "Umschuldungskredit - Wann lohnt er sich wirklich?", cat: "Ratenkredit", excerpt: "Laengere Laufzeit kann entlasten, aber auch den Gesamtpreis erhoehen.", tag: "Analyse" },
    },
    fr: {
      1: { title: "Le WIBOR baisse - Faut-il recalculer sa mensualite maintenant?", cat: "Hypotheque", excerpt: "Le WIBOR 3M reste vers 5,86%. Voici quand un recalcul est utile.", tag: "Analyse" },
      2: { title: "Credit immobilier en EUR ou en PLN - Que choisir en 2026?", cat: "Credit EUR", excerpt: "L'ecart de taux est eleve, mais le risque de change reste central.", tag: "Guide" },
      3: { title: "Credit Logement Familial 2026 - Qui peut en beneficier?", cat: "Programmes publics", excerpt: "Conditions, plafonds et etapes pratiques de demande.", tag: "Programmes" },
      4: { title: "Score credit - 7 actions qui l'ameliorent vraiment", cat: "Finance perso", excerpt: "Ce que la banque regarde vraiment avant la decision finale.", tag: "BIK" },
      5: { title: "TAEG vs taux nominal - Ou se cachent les couts?", cat: "Guide", excerpt: "Comparaison d'offres reelles pour identifier le vrai cout total.", tag: "Guide" },
      6: { title: "Credit de consolidation - Quand est-ce vraiment utile?", cat: "Credit conso", excerpt: "Une mensualite plus basse ne signifie pas toujours un cout total plus faible.", tag: "Analyse" },
    },
    cs: {
      1: { title: "WIBOR klesa - Vyplati se prepocitat splatku?", cat: "Hypoteka", excerpt: "WIBOR 3M je kolem 5,86 %. Ukazujeme, kdy prepocet dava smysl.", tag: "Analyza" },
      2: { title: "Hypoteka v EUR nebo PLN - Co je v roce 2026 lepsi?", cat: "Uver v EUR", excerpt: "Rozdil sazeb je vysoky, ale kurzove riziko je stale dulezite.", tag: "Prirucka" },
      3: { title: "Rodinny uver na bydleni 2026 - Kdo ma narok?", cat: "Statni programy", excerpt: "Podminky programu, limity a prakticky postup podani zadosti.", tag: "Programy" },
      4: { title: "Skore BIK - 7 veci, ktere vysledek skutecne zlepsi", cat: "Osobni finance", excerpt: "Co banky opravdu hodnoti a co je jen casty mytus.", tag: "BIK" },
      5: { title: "RPSN vs nominalni urok - Kde jsou skryte naklady", cat: "Prirucka", excerpt: "Proc nizky nominalni urok nemusi znamenat nejlevnejsi uver.", tag: "Prirucka" },
      6: { title: "Konsolidacni uver - Kdy se opravdu vyplati?", cat: "Spotrebitelsky uver", excerpt: "Nizsi mesicni splatka muze zvysit celkovou cenu uveru.", tag: "Analyza" },
    },
    hu: {
      1: { title: "Csokken a WIBOR - Erdemes most ujraszamolni a torlesztot?", cat: "Jelzaloghitel", excerpt: "A WIBOR 3M 5,86% korul van. Megmutatjuk, mikor eri meg az ujraszamolas.", tag: "Elemzes" },
      2: { title: "EUR vagy PLN jelzalog - Melyik jobb 2026-ban?", cat: "EUR hitel", excerpt: "Nagy a kamatkulonbseg, de az arfolyamkockazat tovabbra is eros.", tag: "Utmutato" },
      3: { title: "Csaladi lakashitel 2026 - Kik jogosultak?", cat: "Allami programok", excerpt: "Feltetelek, limitetek es lepesrol lepesre jelentkezes.", tag: "Programok" },
      4: { title: "BIK pontszam - 7 dolog, ami tenyleg javitja", cat: "Szemelyes penzugyek", excerpt: "Mit nez a bank valojaban, es mely tanacsok csak tevitek.", tag: "BIK" },
      5: { title: "THM vs nominalis kamat - Hol vannak a rejtett koltsegek", cat: "Utmutato", excerpt: "Valos ajanlatok osszehasonlitasa a teljes koltseg ertelmezesehez.", tag: "Utmutato" },
      6: { title: "Hitelkivaltas - Mikor eri meg valojaban?", cat: "Szemelyi kolcson", excerpt: "Az alacsonyabb havi torleszto nem mindig jelent alacsonyabb teljes koltseget.", tag: "Elemzes" },
    },
    nl: {
      1: { title: "WIBOR daalt - Nu je maandlast herberekenen?", cat: "Hypotheek", excerpt: "WIBOR 3M staat rond 5,86%. Dit is wanneer herberekenen zinvol is.", tag: "Analyse" },
      2: { title: "Hypotheek in EUR of PLN - Wat is beter in 2026?", cat: "EUR-lening", excerpt: "Renteverschil blijft groot, maar valutarisico blijft bepalend.", tag: "Gids" },
      3: { title: "Familie woonkrediet 2026 - Wie komt in aanmerking?", cat: "Overheidsprogramma's", excerpt: "Voorwaarden, limieten en praktische aanvraagstappen.", tag: "Programma's" },
      4: { title: "BIK-score - 7 zaken die echt helpen", cat: "Persoonlijke financien", excerpt: "Wat banken echt beoordelen en welke adviezen vooral mythes zijn.", tag: "BIK" },
      5: { title: "JKP vs nominale rente - Waar kosten verborgen zitten", cat: "Gids", excerpt: "Waarom de laagste nominale rente niet altijd de goedkoopste lening is.", tag: "Gids" },
      6: { title: "Consolidatielening - Wanneer is het echt slim?", cat: "Consumptief krediet", excerpt: "Lagere maandlast kan toch leiden tot hogere totale kosten.", tag: "Analyse" },
    },
  };

  const ARTICLE_TRANSLATION_APPEND = {
    en: {
      7: { title: "Down Payment 10% vs 20%: Impact on Payment and Margin", cat: "Mortgage", excerpt: "A lower down payment speeds up purchase but raises long-term financing cost.", tag: "Guide" },
      8: { title: "Prepay the Loan or Keep Money on Deposit?", cat: "Personal Finance", excerpt: "We compare net outcomes after tax and inflation across multiple horizons.", tag: "Analysis" },
      9: { title: "Fixed or Variable Rate in 2026?", cat: "Mortgage", excerpt: "How to choose installment structure under uncertain central bank policy.", tag: "Strategy" },
      10: { title: "Creditworthiness on B2B Contracts: What Banks Count", cat: "Mortgage", excerpt: "Income structure, business tenure, and required records for stronger scoring.", tag: "Practice" },
      11: { title: "How to Read a Loan Agreement Without Mistakes", cat: "Guide", excerpt: "Margin, commissions, add-ons, and early repayment costs explained clearly.", tag: "Contract" },
      12: { title: "Single vs Couple Mortgage: Scoring Differences", cat: "Mortgage", excerpt: "Household setup and co-applicant income can strongly alter bank decisions.", tag: "Analysis" },
      13: { title: "Energy-Efficient Home Loans: EU Incentives and Bonuses", cat: "Government Programs", excerpt: "Overview of grants and lending perks for better building energy classes.", tag: "Programs" },
      14: { title: "Cash Loan for Business or Private Use?", cat: "Cash Loan", excerpt: "Installments, tax treatment, and liability in two different borrowing paths.", tag: "Guide" },
      15: { title: "How to Prepare for a Loan Advisor Meeting", cat: "Guide", excerpt: "A practical checklist of documents and questions before your first call.", tag: "Checklist" },
      16: { title: "Refinancing: When Switching Banks Actually Pays Off", cat: "Mortgage", excerpt: "We calculate break-even after commissions and notary/administrative fees.", tag: "Analysis" },
      17: { title: "EURIBOR and ECB Decisions: Effect on Monthly Payments", cat: "EUR Loan", excerpt: "How benchmark shifts pass through to pricing and final loan affordability.", tag: "Markets" },
      18: { title: "Household Budget Before a Loan: 90-Day Plan", cat: "Personal Finance", excerpt: "A simple plan to improve DTI and build a safety buffer before application.", tag: "Plan" },
    },
    de: {
      7: { title: "Eigenkapital 10% vs 20%: Effekt auf Rate und Marge", cat: "Hypothek", excerpt: "Weniger Eigenkapital beschleunigt den Kauf, erhoeht aber die Gesamtkosten.", tag: "Leitfaden" },
      8: { title: "Sondertilgung oder Festgeld: Was lohnt sich mehr?", cat: "Persoenliche Finanzen", excerpt: "Nettovergleich nach Steuern und Inflation fuer mehrere Zeitfenster.", tag: "Analyse" },
      9: { title: "Fester oder variabler Zinssatz im Jahr 2026?", cat: "Hypothek", excerpt: "Wie Sie die richtige Struktur bei unsicherer Geldpolitik waehlen.", tag: "Strategie" },
      10: { title: "Bonitaet bei B2B: Was Banken am strengsten pruefen", cat: "Hypothek", excerpt: "Einkommensart, Unternehmensdauer und Unterlagen fuer besseres Scoring.", tag: "Praxis" },
      11: { title: "Kreditvertrag richtig lesen: Die wichtigsten Klauseln", cat: "Leitfaden", excerpt: "Marge, Gebuehren, Zusatzprodukte und Vorfaelligkeit klar erklaert.", tag: "Vertrag" },
      12: { title: "Hypothek allein oder zu zweit: Unterschiede im Scoring", cat: "Hypothek", excerpt: "Haushaltsstruktur und Mitantragsteller beeinflussen die Entscheidung stark.", tag: "Analyse" },
      13: { title: "Energieeffizientes Wohnen: Foerderungen und Bonuskredite", cat: "Foerderprogramme", excerpt: "Ueberblick zu Zuschussen fuer bessere Energieklassen von Immobilien.", tag: "Programme" },
      14: { title: "Ratenkredit privat oder fuer das Unternehmen?", cat: "Ratenkredit", excerpt: "Raten, Steuern und Haftung im direkten Vergleich.", tag: "Leitfaden" },
      15: { title: "Vorbereitung auf das Gespraech mit dem Kreditberater", cat: "Leitfaden", excerpt: "Checkliste mit Unterlagen und Fragen fuer den ersten Termin.", tag: "Checkliste" },
      16: { title: "Refinanzierung: Wann sich ein Bankwechsel lohnt", cat: "Hypothek", excerpt: "Break-even nach Gebuehren und Nebenkosten realistisch berechnet.", tag: "Analyse" },
      17: { title: "EURIBOR und EZB-Entscheidungen: Wirkung auf die Rate", cat: "EUR-Kredit", excerpt: "Wie Benchmark-Aenderungen in die Kreditkonditionen durchschlagen.", tag: "Maerkte" },
      18: { title: "Haushaltsbudget vor dem Kredit: 90-Tage-Plan", cat: "Persoenliche Finanzen", excerpt: "Konkreter Plan zur Verbesserung von DTI und Sicherheitsreserve.", tag: "Plan" },
    },
    fr: {
      7: { title: "Apport 10% vs 20%: effet sur mensualite et marge", cat: "Hypotheque", excerpt: "Un apport plus faible accelere l'achat mais augmente le cout total.", tag: "Guide" },
      8: { title: "Rembourser par avance ou placer l'argent?", cat: "Finance perso", excerpt: "Comparatif net apres impots et inflation sur plusieurs horizons.", tag: "Analyse" },
      9: { title: "Taux fixe ou variable en 2026?", cat: "Hypotheque", excerpt: "Comment choisir selon l'incertitude de la politique monetaire.", tag: "Strategie" },
      10: { title: "Solvabilite en B2B: ce que la banque controle le plus", cat: "Hypotheque", excerpt: "Structure de revenus, anciennete et pieces decisives pour le score.", tag: "Pratique" },
      11: { title: "Bien lire un contrat de credit sans erreur", cat: "Guide", excerpt: "Marge, frais, options et cout du remboursement anticipe.", tag: "Contrat" },
      12: { title: "Hypotheque seul vs en couple: ecarts de scoring", cat: "Hypotheque", excerpt: "Le profil du foyer et le co-emprunteur changent fortement la decision.", tag: "Analyse" },
      13: { title: "Credit logement performant: aides et bonus dans l'UE", cat: "Programmes publics", excerpt: "Panorama des soutiens pour les biens avec meilleure classe energie.", tag: "Programmes" },
      14: { title: "Credit conso pro ou perso?", cat: "Credit conso", excerpt: "Mensualites, fiscalite et responsabilite selon le montage choisi.", tag: "Guide" },
      15: { title: "Se preparer a un rendez-vous avec un conseiller credit", cat: "Guide", excerpt: "Checklist de documents et questions avant le premier entretien.", tag: "Checklist" },
      16: { title: "Refinancement: quand changer de banque est rentable", cat: "Hypotheque", excerpt: "Calcul du point mort apres frais bancaires et notariaux.", tag: "Analyse" },
      17: { title: "EURIBOR et BCE: impact direct sur les mensualites", cat: "Credit EUR", excerpt: "Comment les mouvements de reference se transmettent aux offres.", tag: "Marches" },
      18: { title: "Budget menage avant credit: plan 90 jours", cat: "Finance perso", excerpt: "Plan simple pour ameliorer le DTI et renforcer la reserve de securite.", tag: "Plan" },
    },
    cs: {
      7: { title: "Vlastni zdroje 10% vs 20%: dopad na splatku a marzi", cat: "Hypoteka", excerpt: "Nizsi vlastni zdroje urychli nakup, ale zvysi celkove naklady.", tag: "Prirucka" },
      8: { title: "Mimoradna splatka nebo terminovany vklad?", cat: "Osobni finance", excerpt: "Ciste srovnani po dani a inflaci v nekolika horizontech.", tag: "Analyza" },
      9: { title: "Fixni nebo promenna sazba v roce 2026?", cat: "Hypoteka", excerpt: "Jak zvolit strukturu splatky pri nejiste menove politice.", tag: "Strategie" },
      10: { title: "Bonita na B2B: co banka hodnoti nejprisneji", cat: "Hypoteka", excerpt: "Typ prijmu, delka podnikani a dokumenty pro lepsi score.", tag: "Praxe" },
      11: { title: "Jak cist uverovou smlouvu bez chyb", cat: "Prirucka", excerpt: "Marze, poplatky, doplnky a predcasne splaceni jednoduse.", tag: "Smlouva" },
      12: { title: "Hypoteka pro jednotlivce vs par: rozdily ve skore", cat: "Hypoteka", excerpt: "Domacnost a spoluzadatel mohou zasadne zmenit vysledek.", tag: "Analyza" },
      13: { title: "Energeticky usporne bydleni: podpora v EU", cat: "Statni programy", excerpt: "Prehled dotaci a bonusu pro budovy s lepsi energetickou tridou.", tag: "Programy" },
      14: { title: "Spotrebitelsky uver pro firmu nebo soukrome?", cat: "Spotrebitelsky uver", excerpt: "Splatky, dane a odpovednost podle zvoleneho postupu.", tag: "Prirucka" },
      15: { title: "Jak se pripravit na schuzku s uverovym poradcem", cat: "Prirucka", excerpt: "Checklist otazek a dokumentu pred prvnim jednanim.", tag: "Checklist" },
      16: { title: "Refinancovani: kdy se vyplati zmena banky", cat: "Hypoteka", excerpt: "Bod zvratu po zapocteni poplatku a vedlejsich nakladu.", tag: "Analyza" },
      17: { title: "EURIBOR a ECB: dopad na mesicni splatky", cat: "Uver v EUR", excerpt: "Jak se zmeny benchmarku promitaji do konecne ceny uveru.", tag: "Trhy" },
      18: { title: "Domaci rozpocet pred uverem: plan na 90 dni", cat: "Osobni finance", excerpt: "Jednoduchy plan pro zlepseni DTI a vytvoreni rezervy.", tag: "Plan" },
    },
    hu: {
      7: { title: "Onresz 10% vs 20%: hatas a torlesztoreszletre", cat: "Jelzaloghitel", excerpt: "A kisebb onresz gyorsit, de jellemzoen dragitja a teljes finanszirozast.", tag: "Utmutato" },
      8: { title: "Elotorlesztes vagy megtakaritas?", cat: "Szemelyes penzugyek", excerpt: "Netto osszehasonlitas ado es inflacio utan tobb idotavra.", tag: "Elemzes" },
      9: { title: "Fix vagy valtozo kamat 2026-ban?", cat: "Jelzaloghitel", excerpt: "Hogyan valassz bizonytalan jegybanki kornyezetben.", tag: "Strategia" },
      10: { title: "B2B hitelkepesseg: mit nez a bank a legszigorubban", cat: "Jelzaloghitel", excerpt: "Jovedelem-tipus, vallalkozasi mult es kulcsfontossagu iratok.", tag: "Gyakorlat" },
      11: { title: "Hogyan olvass hitelszerzodest hiba nelkul", cat: "Utmutato", excerpt: "Marzs, dijak, extra feltetelek es elotorlesztesi koltseg egyszeruen.", tag: "Szerzodes" },
      12: { title: "Jelzalog egyedul vagy parban: scoring kulonbsegek", cat: "Jelzaloghitel", excerpt: "A haztartasi helyzet es tarsigenylo jelentosen valtoztathat.", tag: "Elemzes" },
      13: { title: "Energiahatekony otthon: EU tamogatasok es bonuszok", cat: "Allami programok", excerpt: "Attekintes a jobb energetikai osztalyu ingatlanok osztonzoierol.", tag: "Programok" },
      14: { title: "Szemelyi kolcson cegre vagy magan celra?", cat: "Szemelyi kolcson", excerpt: "Torleszto, adozas es felelosseg ket finanszirozasi utvonalban.", tag: "Utmutato" },
      15: { title: "Felkoszules hiteltanacsadoi megbeszelesre", cat: "Utmutato", excerpt: "Dokumentum- es kerdeslista az elso megbeszeles elott.", tag: "Checklist" },
      16: { title: "Hitelkivaltas: mikor eri meg bankot valtani", cat: "Jelzaloghitel", excerpt: "Megtérulesi pont szamitasa dijakkal es jarulekos koltsegekkel.", tag: "Elemzes" },
      17: { title: "EURIBOR es EKB dontesek: hatas a havi torlesztesre", cat: "EUR hitel", excerpt: "Hogyan gyuruzik at a benchmark valtozas a vegso hitelkoltsegbe.", tag: "Piacok" },
      18: { title: "Csaladi koltsegvetes hitel elott: 90 napos terv", cat: "Szemelyes penzugyek", excerpt: "Egyszeru terv a DTI javitasara es tartalekepitesre.", tag: "Terv" },
    },
    nl: {
      7: { title: "Eigen inbreng 10% vs 20%: effect op last en marge", cat: "Hypotheek", excerpt: "Minder eigen inbreng versnelt koop, maar verhoogt vaak de totale kosten.", tag: "Gids" },
      8: { title: "Extra aflossen of sparen op deposito?", cat: "Persoonlijke financien", excerpt: "Nettovergelijking na belasting en inflatie over meerdere termijnen.", tag: "Analyse" },
      9: { title: "Vaste of variabele rente in 2026?", cat: "Hypotheek", excerpt: "Hoe kies je de juiste structuur bij onzekere rentevooruitzichten.", tag: "Strategie" },
      10: { title: "Kredietscore op B2B-inkomen: wat telt het zwaarst", cat: "Hypotheek", excerpt: "Inkomensstructuur, ondernemingsduur en documenten voor beter resultaat.", tag: "Praktijk" },
      11: { title: "Zo lees je een kredietcontract zonder fouten", cat: "Gids", excerpt: "Marge, kosten, extra voorwaarden en vervroegd aflossen helder uitgelegd.", tag: "Contract" },
      12: { title: "Hypotheek alleen of als koppel: scoreverschillen", cat: "Hypotheek", excerpt: "Huishoudprofiel en mede-aanvrager kunnen de uitkomst sterk veranderen.", tag: "Analyse" },
      13: { title: "Energiezuinige woning: EU bonus en steunregelingen", cat: "Overheidsprogramma's", excerpt: "Overzicht van voordelen voor woningen met betere energielabels.", tag: "Programma's" },
      14: { title: "Consumptieve lening zakelijk of prive?", cat: "Consumptief krediet", excerpt: "Maandlast, fiscaliteit en aansprakelijkheid in twee leenroutes.", tag: "Gids" },
      15: { title: "Voorbereiding op gesprek met kredietadviseur", cat: "Gids", excerpt: "Checklist met documenten en vragen voor het eerste gesprek.", tag: "Checklist" },
      16: { title: "Herfinanciering: wanneer bankwissel echt loont", cat: "Hypotheek", excerpt: "Break-even inclusief commissies en notariele bijkomende kosten.", tag: "Analyse" },
      17: { title: "EURIBOR en ECB-besluiten: impact op maandlasten", cat: "EUR-lening", excerpt: "Hoe benchmarkbewegingen doorwerken in prijs en betaalbaarheid.", tag: "Markten" },
      18: { title: "Huishoudbudget voor je lening: 90-dagenplan", cat: "Persoonlijke financien", excerpt: "Praktisch plan om DTI te verbeteren en reserve op te bouwen.", tag: "Plan" },
    },
  };

  Object.keys(ARTICLE_TRANSLATION_APPEND).forEach((langCode) => {
    ARTICLES[langCode] = { ...(ARTICLES[langCode] || {}), ...ARTICLE_TRANSLATION_APPEND[langCode] };
  });

  const FAQ = {
    en: [
      { q: "Does KreditEU collect my calculator data?", a: "No. Core calculations run locally in your browser. We do not require login for public tools." },
      { q: "Is this a credit offer?", a: "No. KreditEU is an informational tool. Results are estimates, not a binding financial offer." },
      { q: "Where do bank rates come from?", a: "From public bank tariffs and official sources, refreshed by editors and scheduled jobs." },
      { q: "Can I compare loans across countries?", a: "Yes. Pick a country in the header and the calculator switches currency and benchmarks automatically." },
      { q: "What is the AI analysis feature?", a: "Optional AI summary based on numeric inputs. We avoid sending personal identifiers." },
      { q: "How is the monthly payment calculated?", a: "We use annuity formulas and include rate, term, and selected fee assumptions." },
      { q: "Are all costs included?", a: "We show key costs, but external fees like notary or taxes may require separate checks." },
      { q: "Why does the site show ads?", a: "Ads help fund free access to tools and editorial updates." },
    ],
    de: [
      { q: "Sammelt KreditEU meine Rechnerdaten?", a: "Nein. Die Kernberechnungen laufen lokal im Browser ohne verpflichtendes Login." },
      { q: "Ist das ein Kreditangebot?", a: "Nein. Die Ergebnisse sind informative Schaetzungen und kein verbindliches Angebot." },
      { q: "Woher stammen die Bankzinsen?", a: "Aus oeffentlichen Banktarifen und offiziellen Quellen, regelmaessig aktualisiert." },
      { q: "Kann ich Laender vergleichen?", a: "Ja. Mit dem Landerwechsel werden Waehrung und Referenzsaetze automatisch angepasst." },
      { q: "Was macht die KI-Analyse?", a: "Eine optionale textliche Bewertung basierend auf numerischen Eingaben." },
      { q: "Wie wird die Rate berechnet?", a: "Mit Annuitaetsformeln unter Beruecksichtigung von Laufzeit, Zinssatz und Gebuehren." },
      { q: "Sind alle Kosten enthalten?", a: "Wichtige Kosten ja; externe Nebenkosten sollten separat geprueft werden." },
      { q: "Warum Werbung?", a: "Werbung finanziert den kostenlosen Betrieb und die redaktionellen Updates." },
    ],
    fr: [
      { q: "KreditEU collecte-t-il mes donnees de calcul?", a: "Non. Les calculs principaux se font localement dans votre navigateur." },
      { q: "Est-ce une offre de credit?", a: "Non. Les resultats sont informatifs et non contractuels." },
      { q: "D'ou viennent les taux bancaires?", a: "Des grilles publiques des banques et de sources officielles mises a jour regulierement." },
      { q: "Puis-je comparer plusieurs pays?", a: "Oui. Le choix du pays adapte devise et indicateurs automatiquement." },
      { q: "A quoi sert l'analyse IA?", a: "A fournir un resume optionnel base sur vos valeurs numeriques." },
      { q: "Comment est calculee la mensualite?", a: "Avec des formules d'annuite tenant compte du taux, de la duree et des frais." },
      { q: "Tous les couts sont-ils inclus?", a: "Les principaux oui, mais certains frais externes restent a verifier a part." },
      { q: "Pourquoi des publicites?", a: "Elles permettent de garder l'outil gratuit." },
    ],
    cs: [
      { q: "Sbira KreditEU data z kalkulacky?", a: "Ne. Hlavni vypocty bezi lokalne v prohlizeci bez povinne registrace." },
      { q: "Je to nabidka uveru?", a: "Ne. Vysledky jsou orientacni a nejsou zavaznou nabidkou." },
      { q: "Odkud jsou sazby bank?", a: "Z verejnych cenniku bank a oficialnich zdroju, pravidelne aktualizovanych." },
      { q: "Mohu porovnat vice zemi?", a: "Ano. Volba zeme automaticky meni menu i referencni sazby." },
      { q: "Co dela AI analyza?", a: "Volitelne textove zhodnoceni podle ciselnych vstupu." },
      { q: "Jak se pocita splatka?", a: "Pouzivame anuitni vzorec podle sazby, doby a poplatku." },
      { q: "Jsou zahrnuty vsechny naklady?", a: "Hlavni ano, nektere externi poplatky je treba overit zvlast." },
      { q: "Proc reklamy?", a: "Pomahaji financovat bezplatny provoz sluzby." },
    ],
    hu: [
      { q: "Gyujti a KreditEU a kalkulator adatait?", a: "Nem. A fo szamitasok helyben, a bongeszoben futnak." },
      { q: "Ez hitelajanlat?", a: "Nem. Az eredmenyek tajekoztato jelleguek." },
      { q: "Honnan jonnek a banki kamatok?", a: "Nyilvanos banki arlistakbol es hivatalos forrasokbol." },
      { q: "Lehet tobb orszagot osszehasonlitani?", a: "Igen. Az orszagvaltas automatikusan atallitja a devizat es benchmarkokat." },
      { q: "Mit csinal az AI elemzes?", a: "Opcionális szoveges ertekeles a szamszeru bemenetek alapjan." },
      { q: "Hogyan szamolodik a torleszto?", a: "Annuitas keplettel, futamido, kamat es dijak figyelembevetelevel." },
      { q: "Minden koltseg benne van?", a: "A fo tetelek igen, de kulso dijakat kulon erdemes ellenorizni." },
      { q: "Miert vannak hirdetesek?", a: "A hirdetesek fedezik az ingyenes szolgaltatas koltseget." },
    ],
    nl: [
      { q: "Verzamelt KreditEU rekendata?", a: "Nee. De kernberekeningen draaien lokaal in je browser." },
      { q: "Is dit een kredietaanbod?", a: "Nee. De uitkomsten zijn informatief en niet bindend." },
      { q: "Waar komen bankrentes vandaan?", a: "Uit openbare rentetabellen en officiele bronnen, periodiek bijgewerkt." },
      { q: "Kan ik landen vergelijken?", a: "Ja. Landkeuze past valuta en benchmarks automatisch aan." },
      { q: "Wat doet de AI-analyse?", a: "Optionele tekstuele analyse op basis van numerieke invoer." },
      { q: "Hoe wordt de maandlast berekend?", a: "Met annuiteitsformules op basis van rente, looptijd en kosten." },
      { q: "Zijn alle kosten inbegrepen?", a: "Belangrijke kosten wel, externe posten moet je apart controleren." },
      { q: "Waarom advertenties?", a: "Advertenties helpen de tool gratis beschikbaar te houden." },
    ],
  };

  function resolveLang(lang) {
    const supported = ["pl", "en", "de", "fr", "cs", "hu", "nl"];
    return supported.includes(lang) ? lang : "en";
  }

  function getLocalizedPrograms(lang) {
    const current = resolveLang(lang);
    if (current === "pl") return window.PROGRAMS || [];
    const dict = PROGRAMS[current] || PROGRAMS.en;
    return (window.PROGRAMS || []).map((item) => ({ ...item, ...(dict[item.id] || {}) }));
  }

  function getLocalizedArticles(lang) {
    const current = resolveLang(lang);
    if (current === "pl") return window.ARTICLES || [];
    const dict = ARTICLES[current] || ARTICLES.en;
    return (window.ARTICLES || []).map((item) => ({ ...item, ...(dict[item.id] || {}) }));
  }

  function getLocalizedFaqs(lang) {
    const current = resolveLang(lang);
    if (current === "pl") return window.FAQS || [];
    const dict = FAQ[current] || FAQ.en;
    const base = window.FAQS || [];
    if (!dict.length || !base.length) return base;
    return base.map((item, idx) => ({ ...item, ...(dict[idx] || {}) }));
  }

  const EXTRA_I18N = {
    pl: {
      common: {
        betweenSections: "miedzy sekcjami",
        betweenSectionsAd: "728x90 miedzy sekcjami",
      },
      pages: {
        contact: {
          inboxTitle: "Wewnetrzna skrzynka KreditEU",
        },
      },
      calc: {
        scoreEmployment: "Forma zatrudnienia",
        scoreTenure: "Staz pracy",
        scoreHistory: "Historia kredytowa",
        scoreDti: "Wskaznik DTI",
        scoreAge: "Wiek wnioskodawcy",
        scoreDownPayment: "Wklad wlasny",
        profileEmploymentTitle: "💼 Zatrudnienie i dochody",
        profileEmploymentDesc: "Bank najpierw ocenia stabilnosc dochodu",
        profileFamilyTitle: "👨‍👩‍👧 Sytuacja rodzinna",
        profileFamilyDesc: "Wplywa na koszty utrzymania gospodarstwa",
        profileLiabilitiesTitle: "💳 Zobowiazania i historia kredytowa",
        profileLiabilitiesDesc: "Bank sprawdza Twoja historie przed decyzja",
        profilePropertyTitle: "🏠 Nieruchomosc",
        profilePropertyDesc: "Typ, lokalizacja i stan wplywaja na max LTV",
      },
    },
    en: {
      common: {
        betweenSections: "between sections",
        betweenSectionsAd: "728x90 between sections",
      },
      pages: {
        contact: {
          inboxTitle: "KreditEU Internal Inbox",
        },
      },
    },
    de: {
      common: {
        betweenSections: "zwischen den Abschnitten",
        betweenSectionsAd: "728x90 zwischen Abschnitten",
      },
      pages: {
        contact: {
          inboxTitle: "KreditEU internes Postfach",
        },
      },
      calc: {
        scoreEmployment: "Beschaeftigungsart",
        scoreTenure: "Berufsdauer",
        scoreHistory: "Kredithistorie",
        scoreDti: "DTI-Quote",
        scoreAge: "Alter des Antragstellers",
        scoreDownPayment: "Eigenkapital",
      },
    },
    fr: {
      common: {
        betweenSections: "entre les sections",
        betweenSectionsAd: "728x90 entre sections",
      },
      pages: {
        contact: {
          inboxTitle: "Boite interne KreditEU",
        },
      },
      calc: {
        scoreEmployment: "Type d'emploi",
        scoreTenure: "Anciennete",
        scoreHistory: "Historique credit",
        scoreDti: "Ratio DTI",
        scoreAge: "Age du demandeur",
        scoreDownPayment: "Apport personnel",
      },
    },
    cs: {
      common: {
        betweenSections: "mezi sekcemi",
        betweenSectionsAd: "728x90 mezi sekcemi",
      },
      pages: {
        contact: {
          inboxTitle: "Interni schranka KreditEU",
        },
      },
      calc: {
        scoreEmployment: "Typ zamestnani",
        scoreTenure: "Delka zamestnani",
        scoreHistory: "Uverova historie",
        scoreDti: "Poměr DTI",
        scoreAge: "Vek zadatele",
        scoreDownPayment: "Vlastni zdroje",
      },
    },
    hu: {
      common: {
        betweenSections: "szakaszok kozott",
        betweenSectionsAd: "728x90 szakaszok kozott",
      },
      pages: {
        contact: {
          inboxTitle: "KreditEU belso postafiok",
        },
      },
      calc: {
        scoreEmployment: "Foglalkoztatasi tipus",
        scoreTenure: "Munkaviszony hossza",
        scoreHistory: "Hitelmult",
        scoreDti: "DTI mutato",
        scoreAge: "Igenylo eletkora",
        scoreDownPayment: "Onresz",
      },
    },
    nl: {
      common: {
        betweenSections: "tussen secties",
        betweenSectionsAd: "728x90 tussen secties",
      },
      pages: {
        contact: {
          inboxTitle: "KreditEU interne inbox",
        },
      },
      calc: {
        scoreEmployment: "Type werk",
        scoreTenure: "Duur dienstverband",
        scoreHistory: "Kredietgeschiedenis",
        scoreDti: "DTI-ratio",
        scoreAge: "Leeftijd aanvrager",
        scoreDownPayment: "Eigen inbreng",
      },
    },
  };

  function mergeDeep(target, source) {
    if (!source) return target;
    const out = { ...(target || {}) };
    Object.keys(source).forEach((key) => {
      const sv = source[key];
      const tv = out[key];
      if (sv && typeof sv === "object" && !Array.isArray(sv)) {
        out[key] = mergeDeep(tv && typeof tv === "object" ? tv : {}, sv);
      } else {
        out[key] = sv;
      }
    });
    return out;
  }

  if (window.I18N) {
    Object.keys(EXTRA_I18N).forEach((langCode) => {
      window.I18N[langCode] = mergeDeep(window.I18N[langCode] || {}, EXTRA_I18N[langCode]);
    });
  }

  Object.assign(window, {
    getLocalizedPrograms,
    getLocalizedArticles,
    getLocalizedFaqs,
  });
})();
