Skip to content

Commit

Permalink
Locale fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmanns authored and javiereguiluz committed Jul 30, 2024
1 parent bb6ae0c commit 615470c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Factory/AdminContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ private function getDashboardDto(Request $request, DashboardControllerInterface
foreach ($dashboardControllerRoutes as $routeName => $controller) {
if ($controller === $dashboardController) {
// if present, remove the suffix of i18n route names (it's a two-letter locale at the end
// of the route name; e.g. 'dashboard.en' -> remove '.en', 'admin.index.es' -> remove '.es')
$dashboardRouteName = preg_replace('~\.\w{2}$~', '', $routeName);
// of the route name; e.g. 'dashboard.en' -> remove '.en', 'admin.index.en_US' -> remove '.en_US')
$dashboardRouteName = preg_replace('~\.[a-z]{2}(_[A-Z]{2})?$~', '', $routeName);

break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Router/AdminUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ public function generateUrl(): string
}

// if present, remove the suffix of i18n route names (it's a two-letter locale at the end
// of the route name; e.g. 'dashboard.en' -> remove '.en', 'admin.index.es' -> remove '.es')
$this->dashboardRoute = preg_replace('~\.\w{2}$~', '', $this->dashboardRoute);
// of the route name; e.g. 'dashboard.en' -> remove '.en', 'admin.index.en_US' -> remove '.en_US')
$this->dashboardRoute = preg_replace('~\.[a-z]{2}(_[A-Z]{2})?$~', '', $this->dashboardRoute);

// this removes any parameter with a NULL value
$routeParameters = array_filter(
Expand Down

0 comments on commit 615470c

Please sign in to comment.