Closed hellomohsinhello closed 5 years ago
You are right, this is using the System.Behaviors.SettingsModel which is not currently translatable.
In the mean time, remove the TranslatableModel from your implements[] array and use Rainlab's "Translate Messages" with the twig "_" filter in your markup: {{ gmmessage | }}
Thanks for your comment. Now I have two questions in my mind.
We ware making this setting option for our client where they dont understand the markup ".md" or using content file option in CMS menu. This option was easy for them to make changing in content using rich text editor.
let me show you an example here. I copied this code from plugin GrofGraf\ContactMe which is working fine. I same when i'm doing in my model is not works.
class Settings extends Model
{
use \October\Rain\Database\Traits\Validation;
public $implement = [
'System.Behaviors.SettingsModel',
'@RainLab.Translate.Behaviors.TranslatableModel'
];
public $translatable = [
'name_label',
'email_label',
'attachment_label',
'message_content',
'message_label',
'button_text',
'captcha_label',
'confirmation_message',
'auto_reply_subject',
'auto_reply_content',
'maillist_subscribe_label'
];
// A unique code
public $settingsCode = 'contact_me_settings';
// Reference to field configuration
public $settingsFields = 'fields.yaml';
}
We did not remove any functionality.
You're saying it's working fine in the GrofGraf\ContactMe plugin with the latest version of Rainlab.Translate?
I was able to make this work. In your case, your onStart() method should look like below:
function onStart(){
$this['gm_message'] = Settings::instance()->gm_message;
}
This can be closed as invalid as well.