메소드 | 설명 | |
---|---|---|
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 ( ) : Mcamara\LaravelLocalization\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) |
public static createUrlFromUri ( string $uri ) : string | ||
$uri | string | Uri |
리턴 | string | Url for the given uri |
public static getConfigRepository ( ) : Mcamara\LaravelLocalization\Repository | ||
리턴 | Mcamara\LaravelLocalization\Repository | Configuration repository |
public static getCurrentLocale ( ) : string | ||
리턴 | string | current language |
public static getCurrentLocaleDirection ( ) : string | ||
리턴 | string | current locale direction |
public static getCurrentLocaleName ( ) : string | ||
리턴 | string | current locale name |
public static getCurrentLocaleNative ( ) : string | ||
리턴 | string | current locale native name |
public static getCurrentLocaleNativeReading ( ) : string | ||
리턴 | string | current language's native reading |
public static getCurrentLocaleRegional ( ) : string | ||
리턴 | string | current regional |
public static getCurrentLocaleScript ( ) : string | ||
리턴 | string | current locale script |
public static getDefaultLocale ( ) : string | ||
리턴 | string |
public static 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 static 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 static getRouteNameFromAPath ( string $path ) : string | false | ||
$path | string | Path to get the key translated |
리턴 | string | false | Key for translation, false if not exist |
public static getSupportedLanguagesKeys ( ) : array | ||
리턴 | array | keys of supported languages |
public static getSupportedLocales ( ) : array | ||
리턴 | array |
public static 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 static hideDefaultLocaleInURL ( ) : boolean | ||
리턴 | boolean | Returns value of hideDefaultLocaleInURL in config. |
public static setBaseUrl ( string $url ) | ||
$url | string | Base url for the site |
public static setRouteName ( string $routeName ) | ||
$routeName | string | current route name |
public static setSupportedLocales ( array $locales ) | ||
$locales | array | Locales that the App supports |
public static transRoute ( string $routeName ) : string | ||
$routeName | string | Key of the translated string |
리턴 | string | Translated string |