Property | Type | Description | |
---|---|---|---|
$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 | Holds the locale model. | ||
$request | Illuminate\Http\Request | Holds the current request instance. | |
$translationModel | Holds the translation model. |
Method | Description | |
---|---|---|
__construct ( Illuminate\Contracts\Foundation\Application $app ) | ||
getAppLocale ( ) | ||
getDefaultTranslation ( $text ) | ||
getLocale ( ) | ||
getRoutePrefix ( ) | ||
setLocale ( $code = '' ) | ||
translate ( $text = '', $replacements = [], $toLocale = '', $runOnce = false ) |
Method | Description | |
---|---|---|
autoTranslateEnabled ( ) : boolean | Returns the auto translate configuration option. | |
compressString ( $string ) : string | Calculates the md5 hash of a string. | |
firstOrCreateLocale ( string $code ) : |
Retrieves or creates a locale from the specified code. | |
firstOrCreateTranslation ( |
Creates a translation. | |
getCacheLocale ( string $code ) : boolean | Retrieves a cached locale from the specified locale code. | |
getCacheTranslation ( |
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 ( |
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 ( |
Remove the translation from the cache manually. | |
setCacheLocale ( |
Sets a cache key to the specified locale. | |
setCacheTime ( integer $time ) | Sets the time to store the translations and locales in cache. | |
setCacheTranslation ( |
Sets a cache key to the specified locale and text. | |
validateText ( $text ) : boolean | Validates the inserted text to make sure it's a string. |
public __construct ( Illuminate\Contracts\Foundation\Application $app ) | ||
$app | Illuminate\Contracts\Foundation\Application |
protected autoTranslateEnabled ( ) : boolean | ||
return | boolean |
protected compressString ( $string ) : string | ||
$string | ||
return | string |
protected firstOrCreateLocale ( string $code ) : |
||
$code | string | |
return |
protected firstOrCreateTranslation ( |
||
$locale | ||
$text | string | |
$parentTranslation | ||
return |
protected getCacheLocale ( string $code ) : boolean | ||
$code | string | |
return | boolean |
protected getCacheTranslation ( |
||
$locale | ||
$text | string | |
return | boolean | |
protected getConfigCacheTime ( ) : string | integer | ||
return | string | integer |
protected getConfigClient ( ) : string | ||
return | string |
protected getConfigDefaultLocale ( ) : string | ||
return | string |
protected getConfigLocaleByCode ( string $code ) : string | ||
$code | string | |
return | string |
protected getConfigLocaleModel ( ) : string | ||
return | string |
protected getConfigLocales ( ) : array | ||
return | array |
protected getConfigRequestSegment ( ) : integer | ||
return | integer |
protected getConfigTranslationModel ( ) : string | ||
return | string |
protected getTranslationCacheId ( |
||
$locale | ||
$text | string | |
return | string |
protected makeTranslationSafePlaceholder ( string $key = '' ) : string | ||
$key | string | |
return | string |
protected removeCacheLocale ( string $code ) | ||
$code | string |
protected removeCacheTranslation ( |
||
$translation |
protected setCacheLocale ( |
||
$locale |
protected setCacheTime ( integer $time ) | ||
$time | integer |
protected setCacheTranslation ( |
||
$translation |
public translate ( $text = '', $replacements = [], $toLocale = '', $runOnce = false ) |
protected validateText ( $text ) : boolean | ||
$text | ||
return | boolean |
protected CacheManager,Illuminate\Cache $cache | ||
return | Illuminate\Cache\CacheManager |
protected Client,Stevebauman\Translation\Contracts $client | ||
return | Stevebauman\Translation\Contracts\Client |
protected Repository,Illuminate\Config $config | ||
return | Illuminate\Config\Repository |
protected Model,Illuminate\Database\Eloquent $localeModel | ||
return |
protected Request,Illuminate\Http $request | ||
return | Illuminate\Http\Request |