Méthode | Description | |
---|---|---|
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 |
Résultat | string | Url for the given uri |
public static getConfigRepository ( ) : Mcamara\LaravelLocalization\Repository | ||
Résultat | Mcamara\LaravelLocalization\Repository | Configuration repository |
public static getCurrentLocale ( ) : string | ||
Résultat | string | current language |
public static getCurrentLocaleDirection ( ) : string | ||
Résultat | string | current locale direction |
public static getCurrentLocaleName ( ) : string | ||
Résultat | string | current locale name |
public static getCurrentLocaleNative ( ) : string | ||
Résultat | string | current locale native name |
public static getCurrentLocaleNativeReading ( ) : string | ||
Résultat | string | current language's native reading |
public static getCurrentLocaleRegional ( ) : string | ||
Résultat | string | current regional |
public static getCurrentLocaleScript ( ) : string | ||
Résultat | string | current locale script |
public static getDefaultLocale ( ) : string | ||
Résultat | 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. |
Résultat | 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 |
Résultat | string | URL with no locale in path |
public static getRouteNameFromAPath ( string $path ) : string | false | ||
$path | string | Path to get the key translated |
Résultat | string | false | Key for translation, false if not exist |
public static getSupportedLanguagesKeys ( ) : array | ||
Résultat | array | keys of supported languages |
public static getSupportedLocales ( ) : array | ||
Résultat | 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) |
Résultat | string | false | URL translated |
public static hideDefaultLocaleInURL ( ) : boolean | ||
Résultat | 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 |
Résultat | string | Translated string |