PHP 클래스 Stevebauman\Translation\Translation

상속: implements Stevebauman\Translation\Contracts\Translation
파일 보기 프로젝트 열기: stevebauman/translation

보호된 프로퍼티들

프로퍼티 타입 설명
$cache Illuminate\Cache\CacheManager Holds the current cache instance.
$client Stevebauman\Translation\Contracts\Client Holds the translation client.
$config Illuminate\Config\Repository Holds the current config instance.
$locale string Holds the application locale.
$localeModel Illuminate\Database\Eloquent\Model Holds the locale model.
$request Illuminate\Http\Request Holds the current request instance.
$translationModel Illuminate\Database\Eloquent\Model Holds the translation model.

공개 메소드들

메소드 설명
__construct ( Illuminate\Contracts\Foundation\Application $app )
getAppLocale ( )
getDefaultTranslation ( $text )
getLocale ( )
getRoutePrefix ( )
setLocale ( $code = '' )
translate ( $text = '', $replacements = [], $toLocale = '', $runOnce = false )

보호된 메소드들

메소드 설명
autoTranslateEnabled ( ) : boolean Returns the auto translate configuration option.
compressString ( $string ) : string Calculates the md5 hash of a string.
firstOrCreateLocale ( string $code ) : Model Retrieves or creates a locale from the specified code.
firstOrCreateTranslation ( Model $locale, string $text, Model $parentTranslation = null ) : Model Creates a translation.
getCacheLocale ( string $code ) : boolean Retrieves a cached locale from the specified locale code.
getCacheTranslation ( Model $locale, string $text ) : boolean | Model Retrieves the cached translation from the specified locale and text.
getConfigCacheTime ( ) : string | integer Returns the cache time set from the configuration file.
getConfigClient ( ) : string Returns the translation client from the configuration.
getConfigDefaultLocale ( ) : string Returns the default locale from the configuration.
getConfigLocaleByCode ( string $code ) : string Returns a the english name of the locale code entered from the config file.
getConfigLocaleModel ( ) : string Returns the locale model from the configuration.
getConfigLocales ( ) : array Returns the array of configuration locales.
getConfigRequestSegment ( ) : integer Returns the request segment to retrieve the locale from.
getConfigTranslationModel ( ) : string Returns the translation model from the configuration.
getTranslationCacheId ( Model $locale, string $text ) : string Returns a unique translation code by compressing the text using a PHP compression function.
makeReplacements ( string $text, array $replacements ) : string Make the place-holder replacements on the specified text.
makeTranslationSafePlaceholder ( string $key = '' ) : string Makes a placeholder by the specified key.
makeTranslationSafePlaceholders ( string $text, array $replace = [] ) : mixed Replaces laravel translation placeholders with google translate safe placeholders. Ex:.
removeCacheLocale ( string $code ) Remove a locale from the cache.
removeCacheTranslation ( Model $translation ) Remove the translation from the cache manually.
setCacheLocale ( Model $locale ) Sets a cache key to the specified locale.
setCacheTime ( integer $time ) Sets the time to store the translations and locales in cache.
setCacheTranslation ( Model $translation ) Sets a cache key to the specified locale and text.
validateText ( $text ) : boolean Validates the inserted text to make sure it's a string.

메소드 상세

__construct() 공개 메소드

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

autoTranslateEnabled() 보호된 메소드

Returns the auto translate configuration option.
protected autoTranslateEnabled ( ) : boolean
리턴 boolean

compressString() 보호된 메소드

Used for storing cache keys for translations.
protected compressString ( $string ) : string
$string
리턴 string

firstOrCreateLocale() 보호된 메소드

Retrieves or creates a locale from the specified code.
protected firstOrCreateLocale ( string $code ) : Model
$code string
리턴 Illuminate\Database\Eloquent\Model

firstOrCreateTranslation() 보호된 메소드

Creates a translation.
protected firstOrCreateTranslation ( Model $locale, string $text, Model $parentTranslation = null ) : Model
$locale Illuminate\Database\Eloquent\Model
$text string
$parentTranslation Illuminate\Database\Eloquent\Model
리턴 Illuminate\Database\Eloquent\Model

getAppLocale() 공개 메소드

public getAppLocale ( )

getCacheLocale() 보호된 메소드

Retrieves a cached locale from the specified locale code.
protected getCacheLocale ( string $code ) : boolean
$code string
리턴 boolean

getCacheTranslation() 보호된 메소드

Retrieves the cached translation from the specified locale and text.
protected getCacheTranslation ( Model $locale, string $text ) : boolean | Model
$locale Illuminate\Database\Eloquent\Model
$text string
리턴 boolean | Illuminate\Database\Eloquent\Model

getConfigCacheTime() 보호된 메소드

Returns the cache time set from the configuration file.
protected getConfigCacheTime ( ) : string | integer
리턴 string | integer

getConfigClient() 보호된 메소드

Returns the translation client from the configuration.
protected getConfigClient ( ) : string
리턴 string

getConfigDefaultLocale() 보호된 메소드

Returns the default locale from the configuration.
protected getConfigDefaultLocale ( ) : string
리턴 string

getConfigLocaleByCode() 보호된 메소드

Returns a the english name of the locale code entered from the config file.
protected getConfigLocaleByCode ( string $code ) : string
$code string
리턴 string

getConfigLocaleModel() 보호된 메소드

Returns the locale model from the configuration.
protected getConfigLocaleModel ( ) : string
리턴 string

getConfigLocales() 보호된 메소드

Returns the array of configuration locales.
protected getConfigLocales ( ) : array
리턴 array

getConfigRequestSegment() 보호된 메소드

Returns the request segment to retrieve the locale from.
protected getConfigRequestSegment ( ) : integer
리턴 integer

getConfigTranslationModel() 보호된 메소드

Returns the translation model from the configuration.
protected getConfigTranslationModel ( ) : string
리턴 string

getDefaultTranslation() 공개 메소드

public getDefaultTranslation ( $text )

getLocale() 공개 메소드

public getLocale ( )

getRoutePrefix() 공개 메소드

public getRoutePrefix ( )

getTranslationCacheId() 보호된 메소드

Returns a unique translation code by compressing the text using a PHP compression function.
protected getTranslationCacheId ( Model $locale, string $text ) : string
$locale Illuminate\Database\Eloquent\Model
$text string
리턴 string

makeReplacements() 보호된 메소드

Make the place-holder replacements on the specified text.
protected makeReplacements ( string $text, array $replacements ) : string
$text string
$replacements array
리턴 string

makeTranslationSafePlaceholder() 보호된 메소드

Makes a placeholder by the specified key.
protected makeTranslationSafePlaceholder ( string $key = '' ) : string
$key string
리턴 string

makeTranslationSafePlaceholders() 보호된 메소드

Converts: :name Into: __name__
protected makeTranslationSafePlaceholders ( string $text, array $replace = [] ) : mixed
$text string
$replace array
리턴 mixed

removeCacheLocale() 보호된 메소드

Remove a locale from the cache.
protected removeCacheLocale ( string $code )
$code string

removeCacheTranslation() 보호된 메소드

Remove the translation from the cache manually.
protected removeCacheTranslation ( Model $translation )
$translation Illuminate\Database\Eloquent\Model

setCacheLocale() 보호된 메소드

Sets a cache key to the specified locale.
protected setCacheLocale ( Model $locale )
$locale Illuminate\Database\Eloquent\Model

setCacheTime() 보호된 메소드

Sets the time to store the translations and locales in cache.
protected setCacheTime ( integer $time )
$time integer

setCacheTranslation() 보호된 메소드

Sets a cache key to the specified locale and text.
protected setCacheTranslation ( Model $translation )
$translation Illuminate\Database\Eloquent\Model

setLocale() 공개 메소드

public setLocale ( $code = '' )

translate() 공개 메소드

public translate ( $text = '', $replacements = [], $toLocale = '', $runOnce = false )

validateText() 보호된 메소드

Validates the inserted text to make sure it's a string.
protected validateText ( $text ) : boolean
$text
리턴 boolean

프로퍼티 상세

$cache 보호되어 있는 프로퍼티

Holds the current cache instance.
protected CacheManager,Illuminate\Cache $cache
리턴 Illuminate\Cache\CacheManager

$client 보호되어 있는 프로퍼티

Holds the translation client.
protected Client,Stevebauman\Translation\Contracts $client
리턴 Stevebauman\Translation\Contracts\Client

$config 보호되어 있는 프로퍼티

Holds the current config instance.
protected Repository,Illuminate\Config $config
리턴 Illuminate\Config\Repository

$locale 보호되어 있는 프로퍼티

Holds the application locale.
protected string $locale
리턴 string

$localeModel 보호되어 있는 프로퍼티

Holds the locale model.
protected Model,Illuminate\Database\Eloquent $localeModel
리턴 Illuminate\Database\Eloquent\Model

$request 보호되어 있는 프로퍼티

Holds the current request instance.
protected Request,Illuminate\Http $request
리턴 Illuminate\Http\Request

$translationModel 보호되어 있는 프로퍼티

Holds the translation model.
protected Model,Illuminate\Database\Eloquent $translationModel
리턴 Illuminate\Database\Eloquent\Model