diff --git a/partials/structure/app_config.php b/partials/structure/app_config.php index 49ae6d1..7c93b07 100644 --- a/partials/structure/app_config.php +++ b/partials/structure/app_config.php @@ -6,23 +6,27 @@ $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'http $host = $_SERVER['HTTP_HOST'] ?? app_primary_domain(); $requestUri = $_SERVER['REQUEST_URI'] ?? '/'; +// Aktuelle Sprache & Sprachen aus den GLOBALS (fileload.php) +$currentLang = $GLOBALS['lang'] ?? ($lang ?? 'en'); +$allAvailable = $GLOBALS['availableLangs'] ?? []; + +// Optional: Environment aus config.php (du hattest $env → $GLOBALS['usb_env']) +$env = $GLOBALS['usb_env'] ?? 'prod'; + // ----------------------------------------------- // USBCheck JavaScript-Konfiguration -// (für fakecheck.*, header.js, i18n, usw.) // ----------------------------------------------- $usbConfig = [ - 'lang' => $lang ?? 'en', + 'lang' => $currentLang, // Basis-Pfade 'assetsBase' => '/assets', // Versionierung für JS/CSS - // → wenn ASSET_VERSION definiert ist, wird sie genutzt - // → sonst null (JS-Loader sorgt für ?v= fallback) 'assetVersion'=> defined('ASSET_VERSION') ? ASSET_VERSION : null, // Environment (prod, staging, dev) - 'env' => $GLOBALS['ENV'] ?? 'prod', + 'env' => $env, // Domains 'domains' => [ @@ -36,24 +40,15 @@ $usbConfig = [ 'fakecheck' => [ 'baseUrl' => $GLOBALS['usb_base_url'] ?? '', 'apiBaseUrl' => $GLOBALS['usb_api_base'] ?? 'https://api.usbcheck.it', - 'locale' => $lang ?? 'en', + 'locale' => $currentLang, ], - // ----------------------------------------------- - // i18n: aus fileload.php gefüllt - // ----------------------------------------------- + // i18n-Konfiguration 'i18n' => [ - // Alle verfügbaren Sprachen (code, label, flag) - 'available' => $availableLangs ?? [], - - // Aktuelle Sprache als Code (de/en/fr/it …) - 'current' => $lang ?? 'en', + 'available' => $allAvailable, + 'current' => $currentLang, ], ]; - -// ----------------------------------------------- -// Javascript-Konfiguration in die Seite schreiben -// ----------------------------------------------- ?> - +