PHP Class RainLab\Translate\Models\Message

Inheritance: extends Mode\Model
Mostra file Open project: rainlab/translate-plugin Class Usage Examples

Public Properties

Property Type Description
$cache
$hasNew
$locale
$table The database table used by the model.
$timestamps Indicates if the model should be timestamped.
$url

Protected Properties

Property Type Description
$guarded Guarded fields
$jsonable List of attribute names which are json encoded and decoded from the database.

Public Methods

Method Description
forLocale ( string $locale = null, $default = null ) : string Gets a message for a given locale, or the default.
get ( string $messageId ) : string Creates or finds an untranslated message string.
getContentAttribute ( ) : string Returns the value for the active locale.
importMessageCodes ( array $messages, string $locale = null ) : void Import an array of messages. Only known messages are imported.
importMessages ( array $messages, string $locale = null ) : void Import an array of messages. Only known messages are imported.
saveToCache ( ) : void Save context messages to cache.
setContext ( string $locale, string $url = null ) Set the caching context, the page url.
toLocale ( string $locale = null, string $message ) : void Writes a translated message to a locale.
trans ( string $messageId, array $params = [] ) : string Looks up and translates a message by its string.

Protected Methods

Method Description
makeCacheKey ( ) : string Creates a cache key for storing context messages.
makeMessageCode ( string $messageId ) : string Creates a sterile key for a message.

Method Details

forLocale() public method

Gets a message for a given locale, or the default.
public forLocale ( string $locale = null, $default = null ) : string
$locale string
return string

get() public static method

Creates or finds an untranslated message string.
public static get ( string $messageId ) : string
$messageId string
return string

getContentAttribute() public method

Returns the value for the active locale.
public getContentAttribute ( ) : string
return string

importMessageCodes() public static method

Import an array of messages. Only known messages are imported.
public static importMessageCodes ( array $messages, string $locale = null ) : void
$messages array
$locale string
return void

importMessages() public static method

Import an array of messages. Only known messages are imported.
public static importMessages ( array $messages, string $locale = null ) : void
$messages array
$locale string
return void

makeCacheKey() protected static method

Creates a cache key for storing context messages.
protected static makeCacheKey ( ) : string
return string

makeMessageCode() protected static method

Creates a sterile key for a message.
protected static makeMessageCode ( string $messageId ) : string
$messageId string
return string

saveToCache() public static method

Save context messages to cache.
public static saveToCache ( ) : void
return void

setContext() public static method

Set the caching context, the page url.
public static setContext ( string $locale, string $url = null )
$locale string
$url string

toLocale() public method

Writes a translated message to a locale.
public toLocale ( string $locale = null, string $message ) : void
$locale string
$message string
return void

trans() public static method

Looks up and translates a message by its string.
public static trans ( string $messageId, array $params = [] ) : string
$messageId string
$params array
return string

Property Details

$cache public_oe static_oe property

public static $cache

$guarded protected_oe property

Guarded fields
protected $guarded

$hasNew public_oe static_oe property

public static $hasNew

$jsonable protected_oe property

List of attribute names which are json encoded and decoded from the database.
protected $jsonable

$locale public_oe static_oe property

public static $locale

$table public_oe property

The database table used by the model.
public $table

$timestamps public_oe property

Indicates if the model should be timestamped.
public $timestamps

$url public_oe static_oe property

public static $url