Arcanedev\Localization\Utilities\RouteTranslator::getUrlFromRouteName PHP Method

getUrlFromRouteName() public method

Get URL from route name.
public getUrlFromRouteName ( string $locale, string $defaultLocale, string $transKey, array $attributes = [], boolean | false $defaultHidden = false ) : string
$locale string
$defaultLocale string
$transKey string
$attributes array
$defaultHidden boolean | false
return string
    public function getUrlFromRouteName($locale, $defaultLocale, $transKey, $attributes = [], $defaultHidden = false)
    {
        if (!is_string($locale)) {
            $locale = $defaultLocale;
        }
        $route = '';
        if (!($locale === $defaultLocale && $defaultHidden)) {
            $route = '/' . $locale;
        }
        if ($this->hasTranslation($transKey, $locale)) {
            $translation = $this->trans($transKey, $locale);
            $route = Url::substituteAttributes($attributes, $route . '/' . $translation);
        }
        return $route;
    }