Свойство | Тип | Описание | |
---|---|---|---|
$abridge | whether to abridge the language ID. Default to true. | ||
$attributes | array | Multilingual attributes | |
$currentLanguage | |||
$defaultLanguage | the default language. Example: 'en'. | ||
$dynamicLangClass | whether to dynamically create translation model class. If true, the translation model class will be generated on runtime with the use of the eval() function so no additional php file is needed. See {@link createLangClass()} Default to true. | ||
$forceDelete | whether to force deletion of the associated translations when a base model is deleted. Not needed if using foreign key with 'on delete cascade'. Default to true. | ||
$langClassName | the name of translation model class. | ||
$langClassSuffix | if $langClassName is not set, it will be assumed that $langClassName is get_class($this->owner) . $this->langClassSuffix | ||
$langForeignKey | the name of the foreign key field of the translation table related to base model table. | ||
$languageField | the name of the lang field of the translation table. Default to 'language'. | ||
$languages | array | Available languages It can be a simple array: array('fr', 'en') or an associative array: array('fr' => 'Français', 'en' => 'English') For associative arrays, only the keys will be used. | |
$localizedPrefix | the prefix of the localized attributes in the lang table. Here to avoid collisions in queries. In the translation table, the columns corresponding to the localized attributes have to be name like this: 'l_[name of the attribute]' and the id column (primary key) like this : 'l_id' Default to ''. | ||
$requireTranslations | if this property is set to true required validators will be applied to all translation models. Default to false. | ||
$tableName | the name of the translation table |
Метод | Описание | |
---|---|---|
__get ( $name ) | ||
__isset ( $name ) | ||
__set ( $name, $value ) | ||
afterDelete ( ) | Handle 'afterDelete' event of the owner. | |
afterFind ( ) | Handle 'afterFind' event of the owner. | |
afterInsert ( ) | Handle 'afterInsert' event of the owner. | |
afterUpdate ( ) | Handle 'afterUpdate' event of the owner. | |
attach ( $owner ) | ||
beforeValidate ( ) | Handle 'beforeValidate' event of the owner. | |
canGetProperty ( $name, $checkVars = true ) | ||
canSetProperty ( $name, $checkVars = true ) | ||
createLangClass ( ) | ||
events ( ) | ||
getCurrentLanguage ( ) : mixed | string | ||
getLangAttribute ( string $name ) : string | ||
getTranslation ( $language = null ) : |
Relation to model translation | |
getTranslations ( ) : |
Relation to model translations | |
hasLangAttribute ( string $name ) : boolean | Whether an attribute exists | |
setLangAttribute ( string $name, string $value ) |
Метод | Описание | |
---|---|---|
getAttributeName ( $attribute, $language ) : string | ||
getLanguageBaseName ( $language ) : string | ||
indexByLanguage ( $records ) : array |
Метод | Описание | |
---|---|---|
getShortClassName ( string $className ) : string | ||
saveTranslations ( array $translations = [] ) |
public beforeValidate ( ) |
protected getAttributeName ( $attribute, $language ) : string | ||
$attribute | ||
$language | ||
Результат | string |
public getCurrentLanguage ( ) : mixed | string | ||
Результат | mixed | string |
public getLangAttribute ( string $name ) : string | ||
$name | string | the name of the attribute |
Результат | string | the attribute value |
protected getLanguageBaseName ( $language ) : string | ||
$language | ||
Результат | string |
public getTranslation ( $language = null ) : |
||
$language | ||
Результат |
public getTranslations ( ) : |
||
Результат |
public hasLangAttribute ( string $name ) : boolean | ||
$name | string | the name of the attribute |
Результат | boolean |
protected indexByLanguage ( $records ) : array | ||
$records | ||
Результат | array |
public setLangAttribute ( string $name, string $value ) | ||
$name | string | the name of the attribute |
$value | string | the value of the attribute |
public $dynamicLangClass |
public $forceDelete |
public $langClassSuffix |
public $langForeignKey |
public $languageField |
public array $languages | ||
Результат | array |
public $localizedPrefix |
public $requireTranslations |