PHP Interface Stevebauman\Translation\Contracts\Translation

Show file Open project: stevebauman/translation

Public Methods

Method Description
__construct ( Illuminate\Contracts\Foundation\Application $app ) Constructor.
getAppLocale ( ) : string Retrieves the current app's default locale.
getDefaultTranslation ( string $text ) : Model Returns the translation by the specified text and the applications default locale.
getLocale ( ) : string Retrieves the current locale from the session. If a locale isn't set then the default app locale is set as the current locale.
getRoutePrefix ( ) : null | string Returns a route prefix to automatically set a locale depending on the segment.
setLocale ( string $code = '' ) Sets the default locale property.
translate ( string $text = '', array $replacements = [], string $toLocale = '' ) : string Returns the translation for the current locale.

Method Details

__construct() public method

Constructor.
public __construct ( Illuminate\Contracts\Foundation\Application $app )
$app Illuminate\Contracts\Foundation\Application

getAppLocale() public method

Retrieves the current app's default locale.
public getAppLocale ( ) : string
return string

getDefaultTranslation() public method

Returns the translation by the specified text and the applications default locale.
public getDefaultTranslation ( string $text ) : Model
$text string
return Illuminate\Database\Eloquent\Model

getLocale() public method

Retrieves the current locale from the session. If a locale isn't set then the default app locale is set as the current locale.
public getLocale ( ) : string
return string

getRoutePrefix() public method

Returns a route prefix to automatically set a locale depending on the segment.
public getRoutePrefix ( ) : null | string
return null | string

setLocale() public method

Sets the default locale property.
public setLocale ( string $code = '' )
$code string

translate() public method

Returns the translation for the current locale.
public translate ( string $text = '', array $replacements = [], string $toLocale = '' ) : string
$text string
$replacements array
$toLocale string
return string