Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Middleware/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading