/** * @inheritdoc */ public function getRoute($name, array $params = []) { $routesWithLocale = ['findAll', 'find', 'create', 'update']; $locale = $this->getLocale(); if (in_array($name, $routesWithLocale) && isset($locale)) { $originalResourceName = $this->resourceName; $this->resourceName = "help_center/{$locale}/categories"; $route = parent::getRoute($name, $params); // Reset resourceName so it doesn't affect succeeding calls $this->resourceName = $originalResourceName; return $route; } else { return parent::getRoute($name, $params); } }