not save when input is same Yii::$app->language
phunsanit opened this issue · 1 comments
phunsanit commented
i found when update field with multiple language only field of same language as same as Yii::$app->language value not update
for fixed i edit your MultilingualBehavior.php
line 145
$this->defaultLanguage = $this->getLanguageBaseName($this->defaultLanguage)
to
$this->defaultLanguage = $this->getLanguageBaseName($this->defaultLanguage) . ' NOT CHANGE FOR DEFAULT LANG ';
line 350
foreach ($this->attributes as $attribute) {
$value = $defaultLanguage ? $owner->$attribute : $this->getLangAttribute($this->getAttributeName($attribute, $lang));
to
if ($this->getLangAttribute($this->getAttributeName($attribute, $lang)) != '') {
$value = $this->getLangAttribute($this->getAttributeName($attribute, $lang));
} else if ($this->getLangAttribute($this->getAttributeName($attribute, $defaultLanguage)) != '') {
$value = $this->getLangAttribute($this->getAttributeName($attribute, $defaultLanguage));
} else if (isset($owner->$attribute)) {
$value = $owner->$attribute;
} else {
$value = '';
}
i know it strange code but it work.
regards,
Pitt Phunsanit
atans commented
Example:
Languages : ['zh-CN, 'zh-TW', 'en-US']
Current defaults language: zh-TW'
Abridge: false
FORM
input[name="title_zh_cn"]
default language should input[name="title"]
input[name="title_en_us"]