From 4bb659e1f7bb5850db5695a536428a9b71e3ffe5 Mon Sep 17 00:00:00 2001 From: winter Sparkles Date: Sat, 8 Aug 2026 23:33:27 +0100 Subject: tidy up the localisation stuff --- webroot/index.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'webroot') diff --git a/webroot/index.php b/webroot/index.php index 729cdf2..dd8a6d9 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -30,32 +30,23 @@ $router = new Psso\Router('../routes', $config); $router->registerStatusHandler(404, function ($path) { $resp = new Psso\XMLResponse; - $resp->doc->addAttribute('title', 'Not found'); - $resp->doc->addChild( - 'error', - "The requested page ($path) does not exist." - ); + $resp->doc->addAttribute('title', L('error.not-found')); + $resp->doc->addChild('error', L('error.not-found.long', $path)); $resp->send(); }); $router->registerStatusHandler(405, function ($path) { $method = $_SERVER['REQUEST_METHOD']; $resp = new Psso\XMLResponse; - $resp->doc->addAttribute('title', 'Wrong method'); - $resp->doc->addChild( - 'error', - "Your request method ($method) is not valid for this path." - ); + $resp->doc->addAttribute('title', L('error.wrong-method')); + $resp->doc->addChild('error', L('error.wrong-method.long', $method)); $resp->send(); }); $router->setExceptionHandler(function (Throwable $e) { $resp = new Psso\XMLResponse; - $resp->doc->addAttribute('title', 'Uncaught exception'); - $resp->doc->addChild( - 'error', - $e::class . ': ' . $e->getMessage() - ); + $resp->doc->addAttribute('title', L('error.uncaught')); + $resp->doc->addChild('error', $e::class . ': ' . $e->getMessage()); $resp->send(); error_log($e); }); -- cgit v1.3