diff --git a/src/Middleware/Language.php b/src/Middleware/Language.php index d4fef19f214..35c125480b1 100644 --- a/src/Middleware/Language.php +++ b/src/Middleware/Language.php @@ -79,6 +79,12 @@ public function process( $lang = self::detectLocale($loris, $request); if ($lang !== null) { \setlocale(LC_MESSAGES, $lang . '.utf8'); + // Set the default_locale for intl to match the user preference, + // so that date formatting works correctly. + // PHPCS complains about ini_set not being allowed, but there + // does not seem to be any other way to do this. + //phpcs:ignore + ini_set('intl.default_locale', $lang); return $this->next->process( $request->withAttribute("locale", $lang), $handler