Skip to content

Commit

Permalink
fix: Set translation and locale to be used in Request context from Ro…
Browse files Browse the repository at this point in the history
…adiz ResourceInfo
  • Loading branch information
ambroisemaupate committed Aug 26, 2024
1 parent cc4aacd commit a444bc9
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ protected function normalizeResourcePath(?Request $request, string $path): Persi

$this->addResourceToCacheTags($request, $resource);

// Set translation and locale to be used in Request context
if (null !== $resourceInfo->getTranslation()) {
$request->attributes->set('_translation', $resourceInfo->getTranslation());
}

if (null !== $resourceInfo->getLocale()) {
$request->attributes->set('_locale', $resourceInfo->getLocale());
}

/*
* Or plain entity
*/
Expand Down

0 comments on commit a444bc9

Please sign in to comment.