langugage
This commit is contained in:
@@ -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
|
||||
// -----------------------------------------------
|
||||
?>
|
||||
<script>
|
||||
window.usbConfig = <?= json_encode(
|
||||
|
||||
Reference in New Issue
Block a user