<?php
// public/debug/lang.php

// 1) Rohheader anzeigen
header('Content-Type: text/plain; charset=utf-8');

echo "=== HTTP_ACCEPT_LANGUAGE ===\n";
echo ($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? "(nicht gesetzt)") . "\n\n";

// 2) fileload.php einbinden (macht Session + i18n + functions.php)
require_once $_SERVER['DOCUMENT_ROOT']. '/../config/fileload.php';

echo "=== Ergebnis aus fileload.php ===\n";
echo "Gewähltes \$lang: " . ($GLOBALS['lang'] ?? '(kein lang)') . "\n\n";

echo "=== Verfügbare Sprachen (\$availableLangs) ===\n";
print_r($GLOBALS['availableLangs'] ?? []);

echo "\n=== Aktive Sprachdatei (i18n.current.meta) ===\n";
$current = $GLOBALS['i18n']['current'] ?? [];
if (isset($current['meta'])) {
    print_r($current['meta']);
} else {
    echo "(kein meta in current)\n";
}
