PHP Класс Stevebauman\Translation\Translation

Наследование: implements Stevebauman\Translation\Contracts\Translation
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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