Arcanedev\Localization\Contracts\RouteTranslatorInterface::getTranslatedRoutes PHP Method

getTranslatedRoutes() public method

Get translated routes.
public getTranslatedRoutes ( ) : array
return array
    public function getTranslatedRoutes();

Usage Example

Example #1
0
 /**
  * Returns the translated route for an url and the attributes given and a locale
  *
  * @param  string  $url
  * @param  array   $attributes
  * @param  string  $locale
  *
  * @return string|false
  */
 private function findTranslatedRouteByUrl($url, $attributes, $locale)
 {
     if (empty($url)) {
         return false;
     }
     // check if this url is a translated url
     foreach ($this->routeTranslator->getTranslatedRoutes() as $translatedRoute) {
         $translatedUrl = $this->getUrlFromRouteName($locale, $translatedRoute, $attributes);
         if ($this->getNonLocalizedURL($translatedUrl) === $this->getNonLocalizedURL($url)) {
             return $translatedRoute;
         }
     }
     return false;
 }