PHP Class RainLab\Translate\Models\Message

Inheritance: extends Mode\Model
Afficher le fichier Open project: rainlab/translate-plugin Class Usage Examples

Méthodes publiques

Свойство Type Description
$cache
$hasNew
$locale
$table The database table used by the model.
$timestamps Indicates if the model should be timestamped.
$url

Protected Properties

Свойство Type Description
$guarded Guarded fields
$jsonable List of attribute names which are json encoded and decoded from the database.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

get() public static méthode

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

getContentAttribute() public méthode

Returns the value for the active locale.
public getContentAttribute ( ) : string
Résultat string

importMessageCodes() public static méthode

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

importMessages() public static méthode

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

makeCacheKey() protected static méthode

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

makeMessageCode() protected static méthode

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

saveToCache() public static méthode

Save context messages to cache.
public static saveToCache ( ) : void
Résultat void

setContext() public static méthode

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

toLocale() public méthode

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

trans() public static méthode

Looks up and translates a message by its string.
public static trans ( string $messageId, array $params = [] ) : string
$messageId string
$params array
Résultat 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