PHP 클래스 LaravelLocalization, someline-starter

상속: extends Mcamara\LaravelLocalization\Facades\LaravelLocalization
파일 보기 프로젝트 열기: someline/someline-starter 1 사용 예제들

공개 메소드들

메소드 설명
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)

메소드 상세

checkLocaleInSupportedLocales() 공개 정적인 메소드

Check if Locale exists on the supported locales array
public static checkLocaleInSupportedLocales ( string | boolean $locale ) : boolean
$locale string | boolean string|bool Locale to be checked
리턴 boolean is the locale supported?

createUrlFromUri() 공개 정적인 메소드

Create an url from the uri
public static createUrlFromUri ( string $uri ) : string
$uri string Uri
리턴 string Url for the given uri

getConfigRepository() 공개 정적인 메소드

Returns the config repository for this instance
public static getConfigRepository ( ) : Mcamara\LaravelLocalization\Repository
리턴 Mcamara\LaravelLocalization\Repository Configuration repository

getCurrentLocale() 공개 정적인 메소드

Returns current language
public static getCurrentLocale ( ) : string
리턴 string current language

getCurrentLocaleDirection() 공개 정적인 메소드

Returns current locale direction
public static getCurrentLocaleDirection ( ) : string
리턴 string current locale direction

getCurrentLocaleName() 공개 정적인 메소드

Returns current locale name
public static getCurrentLocaleName ( ) : string
리턴 string current locale name

getCurrentLocaleNative() 공개 정적인 메소드

Returns current locale native name
public static getCurrentLocaleNative ( ) : string
리턴 string current locale native name

getCurrentLocaleNativeReading() 공개 정적인 메소드

Returns current language's native reading
public static getCurrentLocaleNativeReading ( ) : string
리턴 string current language's native reading

getCurrentLocaleRegional() 공개 정적인 메소드

Returns current regional
public static getCurrentLocaleRegional ( ) : string
리턴 string current regional

getCurrentLocaleScript() 공개 정적인 메소드

Returns current locale script
public static getCurrentLocaleScript ( ) : string
리턴 string current locale script

getDefaultLocale() 공개 정적인 메소드

Returns default locale
public static getDefaultLocale ( ) : string
리턴 string

getLocalizedURL() 공개 정적인 메소드

Returns an URL adapted to $locale
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

getNonLocalizedURL() 공개 정적인 메소드

It returns an URL without locale (if it has it) Convenience function wrapping getLocalizedURL(false)
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

getRouteNameFromAPath() 공개 정적인 메소드

Returns the translation key for a given 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

getSupportedLanguagesKeys() 공개 정적인 메소드

Returns supported languages language key
public static getSupportedLanguagesKeys ( ) : array
리턴 array keys of supported languages

getSupportedLocales() 공개 정적인 메소드

Return an array of all supported Locales
public static getSupportedLocales ( ) : array
리턴 array

getURLFromRouteNameTranslated() 공개 정적인 메소드

Returns an URL adapted to the route name and the locale given
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

hideDefaultLocaleInURL() 공개 정적인 메소드

Returns the translation key for a given path
public static hideDefaultLocaleInURL ( ) : boolean
리턴 boolean Returns value of hideDefaultLocaleInURL in config.

localizeURL() 공개 정적인 메소드

Returns an URL adapted to $locale or current locale
public static localizeURL ( string $url = null, string | boolean $locale = null ) : string
$url string URL to adapt. If not passed, the current url would be taken.
$locale string | boolean Locale to adapt, false to remove locale
리턴 string URL translated

setBaseUrl() 공개 정적인 메소드

Sets the base url for the site
public static setBaseUrl ( string $url )
$url string Base url for the site

setLocale() 공개 정적인 메소드

Set and return current locale
public static setLocale ( string $locale = null ) : string
$locale string Locale to set the App to (optional)
리턴 string Returns locale (if route has any) or null (if route does not have a locale)

setRouteName() 공개 정적인 메소드

Set current route name
public static setRouteName ( string $routeName )
$routeName string current route name

setSupportedLocales() 공개 정적인 메소드

Set and return supported locales
public static setSupportedLocales ( array $locales )
$locales array Locales that the App supports

transRoute() 공개 정적인 메소드

Translate routes and save them to the translated routes array (used in the localize route filter)
public static transRoute ( string $routeName ) : string
$routeName string Key of the translated string
리턴 string Translated string