Move rendering into private templates

Add an explicit template renderer with HTML views and partials for the app, bootstrap, package, and catalog pages. Move shared reporting setup into config/reporting.php and relocate stylesheet assets under css/.
This commit is contained in:
www-data
2026-05-26 12:50:26 +02:00
parent 2f2e8869d6
commit 475765e31f
55 changed files with 2328 additions and 1175 deletions
+37
View File
@@ -79,6 +79,43 @@ class LanguageStore
return $fallback !== null ? (string)$fallback : $key;
}
public function translateFormat($key, $language, $values = array(), $fallback = null)
{
return self::formatText($this->translate($key, $language, $fallback), $values);
}
public static function formatText($text, $values, $maxDepth = 8)
{
if (!is_array($values) || count($values) === 0) {
return (string)$text;
}
$text = (string)$text;
for ($depth = 0; $depth < $maxDepth; $depth++) {
$changed = false;
$next = preg_replace_callback('/\{\{\s*([A-Za-z0-9_.-]+)\s*\}\}/', function ($match) use ($values, &$changed) {
$name = $match[1];
if (!array_key_exists($name, $values)) {
return $match[0];
}
$changed = true;
return (string)$values[$name];
}, $text);
$text = $next;
if (!$changed) {
break;
}
}
return $text;
}
public function setTranslation($key, $language, $text)
{
$key = $this->safeKey($key);