This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Sunshine
Sunshine

I'm attemting to include the Rainlabs.Translate plug-in into a plug-in I'm developing. I have a applied the code as per the docs http://octobercms.com/plugin/rainlab-translate but my back-end form is not showing me the translatable controls - the docs state

The back-end forms will automatically detect the presence of translatable fields and replace their controls for multilingual equivalents

In my model I have the following, straight from the documentation:

public $translatable = ['review_text'];
 public static function boot()
{
    // Call default functionality (required)
    parent::boot();

    // Check the translate plugin is installed
    if (!class_exists('RainLab\Translate\Behaviors\TranslatableModel'))
        return;

    // Extend the constructor of the model
    self::extend(function($model){

        // Implement the translatable behavior
        $model->implement[] = 'RainLab.Translate.Behaviors.TranslatableModel';

    });
}

I have 3 locales set up (English, French, Spanish) In my back-end form the review_text field renders as textarea but without any translatable controls. What am I missing?

Sunshine
Sunshine

In then end this proved to be irritatingly simple to resolve. In my fields.yaml file for my model's form I had capitalised the field type:

type: Text

making it all lowercase fixed it

type: text
MadeByFRAME
MadeByFRAME

@Sunshine,

THANK YOU for posting this solution. Would have stumped me for... ever?!

lunfel
lunfel

In my case, I forgot to configure more than one language in the settings. If the plugin detects that you only have one active language, it will not render the multilangual form fields as it is not necessary

didier28788
didier28788

Same here, impossible to get translatable fields in the backend for my plugin... Works perfectly with the Rainlab Blog Plugin.

What am I missing?

<?php namespace Anandita\Jobboard\Models;

  use Model;

  /**
   * Model
   */
  class Job extends Model
  {
      use \October\Rain\Database\Traits\Validation;

      /**
       * @var string The database table used by the model.
       */

   public $table = 'anandita_jobboard_';

      public $implement = ['Rainlab.Translate.Behaviors.TranslatableModel'];

      /**
       * @var array Attributes that support translation, if available.
       */
      public $translatable = [
      'title',
      'content',
      'expertise',
      'hierarchy',
      ['slug', 'index' => true]
  ];

  /**
   * @var array Validation rules
   */
  public $rules = [
  ];
  }

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.