PHP 클래스 Arcanedev\Localization\Utilities\RouteTranslator

저자: ARCANEDEV ([email protected])
상속: implements Arcanedev\Localization\Contracts\RouteTranslatorInterface
파일 보기 프로젝트 열기: arcanedev/localization

보호된 프로퍼티들

프로퍼티 타입 설명
$currentRoute string Current route.
$translatedRoutes array Translated routes collection.

공개 메소드들

메소드 설명
__construct ( Illuminate\Translation\Translator $translator ) Create RouteTranslator instance.
findTranslatedRouteByPath ( string $path, string $locale ) : false | string Returns the translated route for the path and the url given.
getCurrentRoute ( ) : string Get current route.
getRouteNameFromPath ( string $uri, string $locale ) : false | string Returns the translation key for a given path.
getTranslatedRoute ( string $baseUrl, array | false &$parsedUrl, string $defaultLocale, Arcanedev\Localization\Entities\LocaleCollection $supportedLocales ) : string | false Get the translated route.
getTranslatedRoutes ( ) : array Get translated routes.
getUrlFromRouteName ( string $locale, string $defaultLocale, string $transKey, array $attributes = [], boolean | false $defaultHidden = false ) : string Get URL from route name.
hasCurrentRoute ( ) : boolean Check if has current route.
hasTranslation ( string $key, string $locale = null ) : boolean Determine if a translation exists.
setCurrentRoute ( false | string $currentRoute ) : self Set the current route.
trans ( string $route, string | null $locale = null ) : string Translate routes and save them to the translated routes array (used in the localize route filter).

비공개 메소드들

메소드 설명
translate ( string $key, string $locale = null ) : string Get the translation for a given key.

메소드 상세

__construct() 공개 메소드

Create RouteTranslator instance.
public __construct ( Illuminate\Translation\Translator $translator )
$translator Illuminate\Translation\Translator

findTranslatedRouteByPath() 공개 메소드

Returns the translated route for the path and the url given.
public findTranslatedRouteByPath ( string $path, string $locale ) : false | string
$path string - Path to check if it is a translated route
$locale string - Language to check if the path exists
리턴 false | string

getCurrentRoute() 공개 메소드

Get current route.
public getCurrentRoute ( ) : string
리턴 string

getRouteNameFromPath() 공개 메소드

Returns the translation key for a given path.
public getRouteNameFromPath ( string $uri, string $locale ) : false | string
$uri string
$locale string
리턴 false | string

getTranslatedRoute() 공개 메소드

Get the translated route.
public getTranslatedRoute ( string $baseUrl, array | false &$parsedUrl, string $defaultLocale, Arcanedev\Localization\Entities\LocaleCollection $supportedLocales ) : string | false
$baseUrl string
$parsedUrl array | false
$defaultLocale string
$supportedLocales Arcanedev\Localization\Entities\LocaleCollection
리턴 string | false

getTranslatedRoutes() 공개 메소드

Get translated routes.
public getTranslatedRoutes ( ) : array
리턴 array

getUrlFromRouteName() 공개 메소드

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
리턴 string

hasCurrentRoute() 공개 메소드

Check if has current route.
public hasCurrentRoute ( ) : boolean
리턴 boolean

hasTranslation() 공개 메소드

Determine if a translation exists.
public hasTranslation ( string $key, string $locale = null ) : boolean
$key string
$locale string
리턴 boolean

setCurrentRoute() 공개 메소드

Set the current route.
public setCurrentRoute ( false | string $currentRoute ) : self
$currentRoute false | string
리턴 self

trans() 공개 메소드

Translate routes and save them to the translated routes array (used in the localize route filter).
public trans ( string $route, string | null $locale = null ) : string
$route string
$locale string | null
리턴 string

프로퍼티 상세

$currentRoute 보호되어 있는 프로퍼티

Current route.
protected string $currentRoute
리턴 string

$translatedRoutes 보호되어 있는 프로퍼티

Translated routes collection.
protected array $translatedRoutes
리턴 array