warn("Keine supportedLanguages deklariert"); return; } $i18nDir = "$dir/public/i18n"; if (!is_dir($i18nDir)) { $r->fail("Verzeichnis 'public/i18n/' fehlt — pro Sprache eine JSON-Datei erwartet"); return; } $langData = []; foreach ($m['supportedLanguages'] as $lang) { $file = "$i18nDir/$lang.json"; if (!file_exists($file)) { $r->fail("i18n-File fehlt: public/i18n/$lang.json"); continue; } $data = json_decode(file_get_contents($file), true); if (!is_array($data)) { $r->fail("i18n-File '$lang.json' ist kein valides JSON"); continue; } $langData[$lang] = $data; $r->ok("i18n '$lang.json': " . count($data) . " Keys"); } // Easy-Pflicht: für jede Sprache mit -standard muss -easy existieren $standards = array_filter(array_keys($langData), fn($k) => str_ends_with($k, '-standard')); foreach ($standards as $stdLang) { $easyLang = str_replace('-standard', '-easy', $stdLang); if (!isset($langData[$easyLang])) { $r->fail("Easy-Sprache fehlt: '$easyLang' (Pflicht für jedes -standard)"); continue; } // Keys vergleichen $stdKeys = array_keys($langData[$stdLang]); $easyKeys = array_keys($langData[$easyLang]); $missing = array_diff($stdKeys, $easyKeys); if ($missing) { $r->fail("'$easyLang' hat fehlende Keys gegenüber '$stdLang'", array_values($missing)); } else { $r->ok("'$easyLang' deckt alle Keys von '$stdLang' ab"); } $extra = array_diff($easyKeys, $stdKeys); if ($extra) { $r->warn("'$easyLang' hat zusätzliche Keys, die in '$stdLang' fehlen", array_values($extra)); } } }