프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$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. |
메소드 | 설명 | |
---|---|---|
__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 |
메소드 | 설명 | |
---|---|---|
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 | ||
리턴 | array |
public getTranslatableAttributesWithOptions ( ) : array | ||
리턴 | array |
public getTranslateAttributes ( string $locale ) : array | ||
$locale | string | |
리턴 | array |
public getTranslateDirty ( $locale = null ) : array | ||
리턴 | array |
public hasTransatableAttributes ( ) : true | ||
리턴 | true |
public initTranslatableContext ( ) : void | ||
리턴 | void |
public isTranslatable ( string $key ) : boolean | ||
$key | string | |
리턴 | boolean |
abstract protected loadTranslatableData ( string $locale = null ) : array | ||
$locale | string | |
리턴 | array |
public noFallbackLocale ( ) : self | ||
리턴 | self |
abstract protected storeTranslatableData ( string $locale = null ) : void | ||
$locale | string | |
리턴 | void |
public syncTranslatableAttributes ( ) : void | ||
리턴 | void |
public translateContext ( string $context = null ) : void | ||
$context | string | |
리턴 | void |
protected $translatableAttributes |
protected $translatableOriginals |