This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Basicaly, we need to save title in a mentioned language. We use rainlab.translate plugin. For some reson this way it doesn't work:
$newPage = Page::find(1);
$newPage->translateContext('en');
$newPage->title = $title_en;
$newPage->content_html = $content_en;
$newPage->translateContext('ru');
$newPage->title = $title_ru;
$newPage->content_html = $content_ru;
Any suggestions ?
Using the attribute setter it does the thing but buggy. If you are under en language it doesn't save it but the rest are saved.
$newPage->setTranslateAttribute('title', $title_en, 'en');
$newPage->setTranslateAttribute('title', $title_ru, 'ru');
$newPage->setTranslateAttribute('title', $title_lv, 'lv');
Last updated
$deliveryOption->translateContext('lv'); $deliveryOption->title = $title_lv; $deliveryOption->save(null, post('_session_key')); $deliveryOption->setAttributeTranslated('title', $title_en, 'en'); $deliveryOption->setAttributeTranslated('title', $title_ru, 'ru'); $deliveryOption->syncTranslatableAttributes(); $deliveryOption->save(null, post('_session_key'));
1-3 of 3