Mcamara\LaravelLocalization\LaravelLocalization::transRoute PHP Méthode

transRoute() public méthode

Translate routes and save them to the translated routes array (used in the localize route filter)
public transRoute ( string $routeName ) : string
$routeName string Key of the translated string
Résultat string Translated string
    public function transRoute($routeName)
    {
        if (!in_array($routeName, $this->translatedRoutes)) {
            $this->translatedRoutes[] = $routeName;
        }
        return $this->translator->trans($routeName);
    }

Usage Example

Exemple #1
0
 /**
  * Translate routes and save them to the translated routes array (used in the localize route filter)
  *
  * @param string $routeName Key of the translated string
  * @return string Translated string
  * @static 
  */
 public static function transRoute($routeName)
 {
     return \Mcamara\LaravelLocalization\LaravelLocalization::transRoute($routeName);
 }