PHP Класс RainLab\Translate\Models\Message

Наследование: extends Mode\Model
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cache
$hasNew
$locale
$table The database table used by the model.
$timestamps Indicates if the model should be timestamped.
$url

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

Свойство Тип Описание
$guarded Guarded fields
$jsonable List of attribute names which are json encoded and decoded from the database.

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
makeCacheKey ( ) : string Creates a cache key for storing context messages.
makeMessageCode ( string $messageId ) : string Creates a sterile key for a message.

Описание методов

forLocale() публичный Метод

Gets a message for a given locale, or the default.
public forLocale ( string $locale = null, $default = null ) : string
$locale string
Результат string

get() публичный статический Метод

Creates or finds an untranslated message string.
public static get ( string $messageId ) : string
$messageId string
Результат string

getContentAttribute() публичный Метод

Returns the value for the active locale.
public getContentAttribute ( ) : string
Результат string

importMessageCodes() публичный статический Метод

Import an array of messages. Only known messages are imported.
public static importMessageCodes ( array $messages, string $locale = null ) : void
$messages array
$locale string
Результат void

importMessages() публичный статический Метод

Import an array of messages. Only known messages are imported.
public static importMessages ( array $messages, string $locale = null ) : void
$messages array
$locale string
Результат void

makeCacheKey() защищенный статический Метод

Creates a cache key for storing context messages.
protected static makeCacheKey ( ) : string
Результат string

makeMessageCode() защищенный статический Метод

Creates a sterile key for a message.
protected static makeMessageCode ( string $messageId ) : string
$messageId string
Результат string

saveToCache() публичный статический Метод

Save context messages to cache.
public static saveToCache ( ) : void
Результат void

setContext() публичный статический Метод

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

toLocale() публичный Метод

Writes a translated message to a locale.
public toLocale ( string $locale = null, string $message ) : void
$locale string
$message string
Результат void

trans() публичный статический Метод

Looks up and translates a message by its string.
public static trans ( string $messageId, array $params = [] ) : string
$messageId string
$params array
Результат string

Описание свойств

$cache публичное статическое свойство

public static $cache

$guarded защищенное свойство

Guarded fields
protected $guarded

$hasNew публичное статическое свойство

public static $hasNew

$jsonable защищенное свойство

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

$locale публичное статическое свойство

public static $locale

$table публичное свойство

The database table used by the model.
public $table

$timestamps публичное свойство

Indicates if the model should be timestamped.
public $timestamps

$url публичное статическое свойство

public static $url