프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$app | Illuminate\Foundation\Application | Illuminate request class. | |
$baseUrl | string | Illuminate request class. | |
$configRepository | Illuminate\Config\Repository | Config repository. | |
$currentLocale | string | Current locale | |
$defaultLocale | string | Default locale | |
$request | Illuminate\Routing\Request | Illuminate request class. | |
$routeName | string | Name of the translation key of the current route, it is used for url translations | |
$router | Illuminate router class. | ||
$supportedLocales | array | Supported Locales | |
$translatedRoutes | array | An array that contains all routes that should be translated | |
$translator | Illuminate\Translation\Translator | Illuminate translator class. | |
$view | Illuminate\View\Factory | Illuminate view Factory. |
메소드 | 설명 | |
---|---|---|
__construct ( ) | Creates new instance. | |
checkLocaleInSupportedLocales ( string | boolean $locale ) : boolean | Check if Locale exists on the supported locales array | |
createUrlFromUri ( string $uri ) : string | Create an url from the uri | |
getConfigRepository ( ) : Illuminate\Config\Repository | Returns the config repository for this instance | |
getCurrentLocale ( ) : string | Returns current language | |
getCurrentLocaleDirection ( ) : string | Returns current locale direction | |
getCurrentLocaleName ( ) : string | Returns current locale name | |
getCurrentLocaleNative ( ) : string | Returns current locale native name | |
getCurrentLocaleNativeReading ( ) : string | Returns current language's native reading | |
getCurrentLocaleRegional ( ) : string | Returns current regional | |
getCurrentLocaleScript ( ) : string | Returns current locale script | |
getDefaultLocale ( ) : string | Returns default locale | |
getLocalizedURL ( string | boolean $locale = null, string | false $url = null, array $attributes = [] ) : string | false | Returns an URL adapted to $locale | |
getNonLocalizedURL ( string | false $url = null ) : string | It returns an URL without locale (if it has it) Convenience function wrapping getLocalizedURL(false) | |
getRouteNameFromAPath ( string $path ) : string | false | Returns the translation key for a given path | |
getSupportedLanguagesKeys ( ) : array | Returns supported languages language key | |
getSupportedLocales ( ) : array | Return an array of all supported Locales | |
getURLFromRouteNameTranslated ( string | boolean $locale, string $transKeyName, array $attributes = [] ) : string | false | Returns an URL adapted to the route name and the locale given | |
hideDefaultLocaleInURL ( ) : boolean | Returns the translation key for a given path | |
localizeURL ( string $url = null, string | boolean $locale = null ) : string | Returns an URL adapted to $locale or current locale | |
setBaseUrl ( string $url ) | Sets the base url for the site | |
setLocale ( string $locale = null ) : string | Set and return current locale | |
setRouteName ( string $routeName ) | Set current route name | |
setSupportedLocales ( array $locales ) | Set and return supported locales | |
transRoute ( string $routeName ) : string | Translate routes and save them to the translated routes array (used in the localize route filter) |
메소드 | 설명 | |
---|---|---|
checkUrl ( string $url ) : boolean | Returns true if the string given is a valid url | |
extractAttributes ( boolean | false | null | string $url = false, string $locale = '' ) : array | Extract attributes for current url | |
findTranslatedRouteByPath ( string $path, string $url_locale ) : string | false | Returns the translated route for the path and the url given | |
findTranslatedRouteByUrl ( string | false | null $url, array $attributes, string $locale ) : string | false | Returns the translated route for an url and the attributes given and a locale | |
getTranslatedRoutes ( ) : array | Returns translated routes | |
substituteAttributesInRoute ( $attributes, string $route ) : string | Change route attributes for the ones in the $attributes array | |
unparseUrl ( array | false $parsed_url ) : string | Build URL using array data from parse_url | |
useAcceptLanguageHeader ( ) : boolean | Returns the translation key for a given path |
public createUrlFromUri ( string $uri ) : string | ||
$uri | string | Uri |
리턴 | string | Url for the given uri |
protected findTranslatedRouteByUrl ( string | false | null $url, array $attributes, string $locale ) : string | false | ||
$url | string | false | null | Url to check if it is a translated route |
$attributes | array | Attributes to check if the url exists in the translated routes array |
$locale | string | Language to check if the url exists |
리턴 | string | false | Key for translation, false if not exist |
public getConfigRepository ( ) : Illuminate\Config\Repository | ||
리턴 | Illuminate\Config\Repository | Configuration repository |
public getCurrentLocale ( ) : string | ||
리턴 | string | current language |
public getCurrentLocaleDirection ( ) : string | ||
리턴 | string | current locale direction |
public getCurrentLocaleName ( ) : string | ||
리턴 | string | current locale name |
public getCurrentLocaleNative ( ) : string | ||
리턴 | string | current locale native name |
public getCurrentLocaleNativeReading ( ) : string | ||
리턴 | string | current language's native reading |
public getCurrentLocaleRegional ( ) : string | ||
리턴 | string | current regional |
public getCurrentLocaleScript ( ) : string | ||
리턴 | string | current locale script |
public getLocalizedURL ( string | boolean $locale = null, string | false $url = null, array $attributes = [] ) : string | false | ||
$locale | string | boolean | Locale to adapt, false to remove locale |
$url | string | false | URL to adapt in the current language. If not passed, the current url would be taken. |
$attributes | array | Attributes to add to the route, if empty, the system would try to extract them from the url. |
리턴 | string | false | URL translated, False if url does not exist |
public getNonLocalizedURL ( string | false $url = null ) : string | ||
$url | string | false | URL to clean, if false, current url would be taken |
리턴 | string | URL with no locale in path |
public getRouteNameFromAPath ( string $path ) : string | false | ||
$path | string | Path to get the key translated |
리턴 | string | false | Key for translation, false if not exist |
public getSupportedLanguagesKeys ( ) : array | ||
리턴 | array | keys of supported languages |
public getSupportedLocales ( ) : array | ||
리턴 | array |
protected getTranslatedRoutes ( ) : array | ||
리턴 | array | translated routes |
public getURLFromRouteNameTranslated ( string | boolean $locale, string $transKeyName, array $attributes = [] ) : string | false | ||
$locale | string | boolean | Locale to adapt |
$transKeyName | string | Translation key name of the url to adapt |
$attributes | array | Attributes for the route (only needed if transKeyName needs them) |
리턴 | string | false | URL translated |
public hideDefaultLocaleInURL ( ) : boolean | ||
리턴 | boolean | Returns value of hideDefaultLocaleInURL in config. |
public setBaseUrl ( string $url ) | ||
$url | string | Base url for the site |
public setRouteName ( string $routeName ) | ||
$routeName | string | current route name |
public setSupportedLocales ( array $locales ) | ||
$locales | array | Locales that the App supports |
protected substituteAttributesInRoute ( $attributes, string $route ) : string | ||
$attributes | array Array of attributes | |
$route | string | string route to substitute |
리턴 | string | route with attributes changed |
public transRoute ( string $routeName ) : string | ||
$routeName | string | Key of the translated string |
리턴 | string | Translated string |
protected unparseUrl ( array | false $parsed_url ) : string | ||
$parsed_url | array | false | Array of data from parse_url function |
리턴 | string | Returns URL as string. |
protected useAcceptLanguageHeader ( ) : boolean | ||
리턴 | boolean | Returns value of useAcceptLanguageHeader in config. |
protected Application,Illuminate\Foundation $app | ||
리턴 | Illuminate\Foundation\Application |
protected Repository,Illuminate\Config $configRepository | ||
리턴 | Illuminate\Config\Repository |
protected Request,Illuminate\Routing $request | ||
리턴 | Illuminate\Routing\Request |
protected string $routeName | ||
리턴 | string |
protected Router,Illuminate\Routing $router | ||
리턴 |
protected array $translatedRoutes | ||
리턴 | array |
protected Translator,Illuminate\Translation $translator | ||
리턴 | Illuminate\Translation\Translator |