/* global React */
// i18n — bilingual FR/EN string tables
const STRINGS = {
  fr: {
    // Nav
    "nav.work": "Espace de travail",
    "nav.dashboard": "Tableau de bord",
    "nav.projects": "Projets",
    "nav.programmes": "Programmes",
    "nav.sectors": "Gestion des secteurs",
    "nav.indicators_group": "Indicateurs",
    "nav.indicator_defs": "Définition des indicateurs",
    "nav.indicators": "Suivi des indicateurs",
    "nav.activities": "Activités",
    "nav.baseline": "Baseline",
    "nav.mobile": "Collecte de données",
    "nav.workflow": "Validation",
    "nav.notifications": "Notifications",
    "nav.project": "Projet",
    "nav.modules": "Modules S&E",
    "nav.audit_system": "Audit système S&E",
    "nav.audit_data": "Audit des données",
    "nav.audit_dashboard": "Synthèse audits",
    "nav.reporting": "Reporting",
    "nav.learning": "Apprentissage",
    "nav.exante": "Évaluation ex ante",
    "nav.exante_group": "Évaluation ex ante",
    "nav.exante.overview":            "Vue d'ensemble",
    "nav.exante.demo":                "Modèle de rapport",
    // Section dividers
    "nav.exante.section.foundations": "── Fondations ──",
    "nav.exante.section.financial":   "── Analyse financière ──",
    "nav.exante.section.economic":    "── Analyse économique ──",
    "nav.exante.section.decision":    "── Qualité & décision ──",
    // Cards
    "nav.exante.decision":            "★ Décision finale",
    "nav.exante.identification":      "Identification",
    "nav.exante.inputs":              "Paramètres globaux",
    "nav.exante.scenarios":           "Scénarios Bas/Moy/Haut",
    "nav.exante.calendar":            "Calendrier",
    "nav.exante.capex":               "CAPEX",
    "nav.exante.opex":                "OPEX",
    "nav.exante.revenue":             "Revenus",
    "nav.exante.financing":           "Plan de financement",
    "nav.exante.findicators":         "Indicateurs financiers",
    "nav.exante.debt":                "Échéancier dette",
    "nav.exante.pl":                  "Compte de résultat",
    "nav.exante.cashflow":            "Cash flow",
    "nav.exante.stakeholders":        "Comptes par acteur",
    "nav.exante.public_finance":      "Impact Finances publiques",
    "nav.exante.mpr_p1":              "MPR 1 — Transferts",
    "nav.exante.mpr_p2":              "MPR 2 — Externalités",
    "nav.exante.mpr_p3":              "MPR 3 — Facteurs",
    "nav.exante.eindicators":         "Indicateurs économiques",
    "nav.exante.quality":             "Contrôle qualité",
    "nav.exante.multicriteria":       "Analyse multicritère",
    "nav.exante.institutional":       "Analyse institutionnelle",
    "nav.exante.sensitivity":         "Sensibilité",
    // Legacy keys kept as aliases for backward compatibility (just in case)
    "nav.exante.context":             "II. Contexte et justification",
    "nav.exante.baseline":            "III. Situation sans projet",
    "nav.exante.description":         "IV. Description du projet",
    "nav.exante.finance":             "V. Analyse financière",
    "nav.exante.economy":             "VI. Analyse économique",
    "nav.exante.actors":              "VII. Analyse par acteur",
    "nav.exante.environment":         "IX. Environnemental & social",
    "nav.exante.funding":             "XI. Plan de financement",
    "nav.exante.budget_impact":       "XII. Impact sur les Finances publiques",
    "nav.exante.recommendations":     "XIII. Recommandations",
    "nav.admin": "Administration",
    "nav.org": "Organisation & rôles",
    "nav.org.overview":      "Vue d'ensemble",
    "nav.org.matrix":        "Matrice rôles × permissions",
    "nav.org.members":       "Membres & rôles",
    "nav.org.project_agents":"Affectations aux projets",
    "nav.org.pending":       "Inscrits en attente",
    "nav.org.invitations":   "Invitations par lien",
    "nav.org.modules":       "Modules par organisation",
    "nav.organizations": "Gestion des Organisations",
    "nav.form_builder": "Formulaires",
    "nav.settings": "Paramètres",
    "nav.help": "Aide",

    // Topbar
    "top.search": "Rechercher projets, indicateurs, sites…",
    "top.new": "Nouveau",

    // Common
    "c.export": "Exporter",
    "c.import": "Importer",
    "c.filter": "Filtrer",
    "c.share": "Partager",
    "c.save": "Enregistrer",
    "c.cancel": "Annuler",
    "c.edit": "Modifier",
    "c.add": "Ajouter",
    "c.see_all": "Voir tout",
    "c.status": "Statut",
    "c.owner": "Responsable",
    "c.due": "Échéance",
    "c.last_update": "Dernière MAJ",
    "c.target": "Cible",
    "c.actual": "Réel",
    "c.baseline": "Baseline",
    "c.progress": "Progression",
    "c.value": "Valeur",
    "c.unit": "Unité",
    "c.site": "Site",
    "c.sites": "Sites",
    "c.region": "Région",
    "c.country": "Pays",
    "c.period": "Période",

    // Dashboard
    "dash.title": "Vue d'ensemble — Q1 2026",
    "dash.eyebrow": "PORTEFEUILLE / SANTÉ",
    "dash.kpi.projects": "Projets actifs",
    "dash.kpi.indicators": "Indicateurs suivis",
    "dash.kpi.disbursed": "Décaissé",
    "dash.kpi.beneficiaries": "Bénéficiaires",
    "dash.section.portfolio": "État du portefeuille",
    "dash.section.activity": "Activité récente",
    "dash.section.alerts": "Alertes & échéances",
    "dash.section.performance": "Performance par programme",

    // Lang switch
    "lang.fr": "FR",
    "lang.en": "EN",
  },
  en: {
    "nav.work": "Workspace",
    "nav.dashboard": "Dashboard",
    "nav.projects": "Projects",
    "nav.programmes": "Programmes",
    "nav.sectors": "Sectors management",
    "nav.indicators_group": "Indicators",
    "nav.indicator_defs": "Indicator definitions",
    "nav.indicators": "Indicator tracking",
    "nav.activities": "Activities",
    "nav.baseline": "Baseline",
    "nav.mobile": "Data Collection",
    "nav.workflow": "Validation",
    "nav.notifications": "Notifications",
    "nav.project": "Project",
    "nav.modules": "M&E modules",
    "nav.audit_system": "M&E system audit",
    "nav.audit_data": "Data audit",
    "nav.audit_dashboard": "Audit dashboard",
    "nav.reporting": "Reporting",
    "nav.learning": "Learning",
    "nav.exante": "Ex-ante appraisal",
    "nav.exante_group": "Ex-ante appraisal",
    "nav.exante.overview":            "Overview",
    "nav.exante.demo":                "Report template",
    "nav.exante.section.foundations": "── Foundations ──",
    "nav.exante.section.financial":   "── Financial analysis ──",
    "nav.exante.section.economic":    "── Economic analysis ──",
    "nav.exante.section.decision":    "── Quality & decision ──",
    "nav.exante.decision":            "★ Final decision",
    "nav.exante.identification":      "Identification",
    "nav.exante.inputs":              "Global parameters",
    "nav.exante.scenarios":           "Low/Mid/High scenarios",
    "nav.exante.calendar":            "Schedule",
    "nav.exante.capex":               "CAPEX",
    "nav.exante.opex":                "OPEX",
    "nav.exante.revenue":             "Revenue",
    "nav.exante.financing":           "Financing plan",
    "nav.exante.findicators":         "Financial indicators",
    "nav.exante.debt":                "Debt schedule",
    "nav.exante.pl":                  "Income statement",
    "nav.exante.cashflow":            "Cash flow",
    "nav.exante.stakeholders":        "Stakeholder accounts",
    "nav.exante.public_finance":      "Public Finance impact",
    "nav.exante.mpr_p1":              "MPR 1 — Transfers",
    "nav.exante.mpr_p2":              "MPR 2 — Externalities",
    "nav.exante.mpr_p3":              "MPR 3 — Factors",
    "nav.exante.eindicators":         "Economic indicators",
    "nav.exante.quality":             "Quality grid",
    "nav.exante.multicriteria":       "Multi-criteria",
    "nav.exante.institutional":       "Institutional",
    "nav.exante.sensitivity":         "Sensitivity",
    // Legacy aliases
    "nav.exante.context":             "II. Context & rationale",
    "nav.exante.baseline":            "III. Without-project",
    "nav.exante.description":         "IV. Project description",
    "nav.exante.finance":             "V. Financial analysis",
    "nav.exante.economy":             "VI. Economic analysis",
    "nav.exante.actors":              "VII. Stakeholder analysis",
    "nav.exante.environment":         "IX. Environmental & social",
    "nav.exante.funding":             "XI. Financing plan",
    "nav.exante.budget_impact":       "XII. Impact on public finances",
    "nav.exante.recommendations":     "XIII. Recommendations",
    "nav.admin": "Administration",
    "nav.org": "Organization & roles",
    "nav.org.overview":      "Overview",
    "nav.org.matrix":        "Roles × permissions matrix",
    "nav.org.members":       "Members & roles",
    "nav.org.project_agents":"Project assignments",
    "nav.org.pending":       "Pending sign-ups",
    "nav.org.invitations":   "Invitation links",
    "nav.org.modules":       "Modules per organization",
    "nav.organizations": "Organization Management",
    "nav.form_builder": "Forms",
    "nav.settings": "Settings",
    "nav.help": "Help",

    "top.search": "Search projects, indicators, sites…",
    "top.new": "New",

    "c.export": "Export",
    "c.import": "Import",
    "c.filter": "Filter",
    "c.share": "Share",
    "c.save": "Save",
    "c.cancel": "Cancel",
    "c.edit": "Edit",
    "c.add": "Add",
    "c.see_all": "See all",
    "c.status": "Status",
    "c.owner": "Owner",
    "c.due": "Due",
    "c.last_update": "Last update",
    "c.target": "Target",
    "c.actual": "Actual",
    "c.baseline": "Baseline",
    "c.progress": "Progress",
    "c.value": "Value",
    "c.unit": "Unit",
    "c.site": "Site",
    "c.sites": "Sites",
    "c.region": "Region",
    "c.country": "Country",
    "c.period": "Period",

    "dash.title": "Portfolio overview — Q1 2026",
    "dash.eyebrow": "PORTFOLIO / HEALTH",
    "dash.kpi.projects": "Active projects",
    "dash.kpi.indicators": "Tracked indicators",
    "dash.kpi.disbursed": "Disbursed",
    "dash.kpi.beneficiaries": "Beneficiaries",
    "dash.section.portfolio": "Portfolio status",
    "dash.section.activity": "Recent activity",
    "dash.section.alerts": "Alerts & deadlines",
    "dash.section.performance": "Performance by program",

    "lang.fr": "FR",
    "lang.en": "EN",
  },
};

window.makeT = (lang) => (key) => (STRINGS[lang] && STRINGS[lang][key]) || STRINGS.fr[key] || key;
