Property | Type | Description | |
---|---|---|---|
$model | Reference to the extended model. | ||
$requiredProperties | {@inheritDoc} | ||
$translatableAttributes | Data store for translated attributes. | ||
$translatableContext | Active language for translations. | ||
$translatableDefault | Default system language. | ||
$translatableOriginals | Data store for original translated attributes. | ||
$translatableUseFallback | Determines if empty translations should be replaced by default values. |
Method | Description | |
---|---|---|
__construct ( October\Rain\Database\Model $model ) | Constructor | |
getAttributeTranslated ( string $key, string $locale = null ) : string | Returns a translated attribute value. | |
getTranslatableAttributes ( ) : array | Returns a collection of fields that will be hashed. | |
getTranslatableAttributesWithOptions ( ) : array | Returns the defined options for a translatable attribute. | |
getTranslateAttribute ( $key, $locale = null ) | ||
getTranslateAttributes ( string $locale ) : array | Returns all translated attribute values. | |
getTranslateDirty ( $locale = null ) : array | Get the translated attributes that have been changed since last sync. | |
hasTransatableAttributes ( ) : true | Checks if this model has transatable attributes. | |
hasTranslation ( string $key, string $locale ) : boolean | Returns whether the attribute is translatable (has a translation) for the given locale. | |
initTranslatableContext ( ) : void | Initializes this class, sets the default language code to use. | |
isTranslatable ( string $key ) : boolean | Checks if an attribute should be translated or not. | |
isTranslateDirty ( string | null $attribute = null, $locale = null ) : boolean | Determine if the model or a given translated attribute has been modified. | |
lang ( string $context = null ) : self | Shorthand for translateContext method, and chainable. | |
noFallbackLocale ( ) : self | Disables translation fallback locale. | |
setAttributeTranslated ( string $key, string $value, $locale = null ) : string | Sets a translated attribute value. | |
setTranslateAttribute ( $key, $value, $locale = null ) | ||
syncTranslatableAttributes ( ) : void | Restores the default language values on the model and stores the translated values in the attributes table. | |
translateContext ( string $context = null ) : void | Changes the active language for this model |
Method | Description | |
---|---|---|
getAttributeFromData ( mixed $data, string $attribute ) : mixed | Extracts a attribute from a model/array with nesting support. | |
loadTranslatableData ( string $locale = null ) : array | Loads the translation data from the model. | |
setAttributeFromData ( mixed &$data, string $attribute, $value ) : mixed | Sets an attribute from a model/array with nesting support. | |
storeTranslatableData ( string $locale = null ) : void | Saves the translation data for the model. |
public __construct ( October\Rain\Database\Model $model ) | ||
$model | October\Rain\Database\Model | The extended model. |
public getTranslatableAttributes ( ) : array | ||
return | array |
public getTranslatableAttributesWithOptions ( ) : array | ||
return | array |
public getTranslateAttributes ( string $locale ) : array | ||
$locale | string | |
return | array |
public getTranslateDirty ( $locale = null ) : array | ||
return | array |
public hasTransatableAttributes ( ) : true | ||
return | true |
public initTranslatableContext ( ) : void | ||
return | void |
public isTranslatable ( string $key ) : boolean | ||
$key | string | |
return | boolean |
abstract protected loadTranslatableData ( string $locale = null ) : array | ||
$locale | string | |
return | array |
public noFallbackLocale ( ) : self | ||
return | self |
abstract protected storeTranslatableData ( string $locale = null ) : void | ||
$locale | string | |
return | void |
public syncTranslatableAttributes ( ) : void | ||
return | void |
public translateContext ( string $context = null ) : void | ||
$context | string | |
return | void |
protected $translatableAttributes |
protected $translatableContext |
protected $translatableOriginals |