#211

Product support

Get help in the plugin support forum.

  • Added on Nov 15, 2017
  • Current version: 1.0.2
  • License: MIT
  • Created by

Categories

  • Utility

This plugin adds possibility to display translatable fields grouped into tabs by locales using translations formwidget.

Can be also used in theme options form just by adding _translations field in the config (see the Documentation for example).

Requirements

RainLab.Translate plugin

Purpose

If you got a lot of translatable fields in a form it could be more convenient to switch all the fields locale at once rather then switching every field.

You may like my other plugins

  • Front-end hierarchic roles - Allows to manage access rights based on roles hierarchy
  • Excel - excel import-export tools
  • JWT Auth API - Token Authentication for API integrated with RainLab.User
  • Blog Views - Enables blog posts views tracking and displaying popular articles.

These plugin(s) are required for the plugin:

You can find fields.yaml code for this example in the documentation tab

Usage

In model class you need to add 'Vdomah.TranslateTabs.Behaviors.TranslateTabbable' behavior to $implement array besides TranslatableModel behavior. Then define translatable attributes as you would do usually with Translate plugin.

public $implement = [
    'RainLab.Translate.Behaviors.TranslatableModel',
    'Vdomah.TranslateTabs.Behaviors.TranslateTabbable',
];

public $translatable = ['name', 'excerpt', 'slug'];

In fields.yaml need to define _translations field like this (exact result of this config you can see on screenshot):

_translations:
    span: left
    type: translations
    form:
        fields:
            name:
                label: Name
                span: auto
                type: text
            slug:
                label: Slug
                span: auto
                preset:
                    field: name
                    type: slug
                type: text
            excerpt:
                label: Excerpt
                span: auto
                type: textarea

Same config works for theme options form in theme.yaml.

  • Found the plugin useful on 16 Nov, 2017

    Don't you know, by holding CTRL when switching field language you switch all fields in form simultaneously?

  • author

    Replied on 16 Nov, 2017

    Clients don't know about Ctrl and don't want to know :) After several complains from different clients I decided to do the translations in tabs. It's just more obvious and visualy easier to understand.

1.0.2

Translatable tabs for theme options form.

Nov 27, 2017

1.0.1

Initialize plugin.

Nov 13, 2017