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.
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.
-
Jack Sun
Found the plugin useful on 11 May, 2018
Thanks for this plugin. Can I use this for field type like "richeditor"? Currently, the field seems being ignored of some types.
-
amdad
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?
-
Art 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.5 |
Fixed locale error in Translations widget. Nov 01, 2021 |
---|---|
1.0.4 |
Fixed Countable error when using PHP >= 7.2; Tabs names from language name instead of code. Jan 20, 2020 |
1.0.3 |
Set translatable attribute values before model validation. Feb 10, 2018 |
1.0.2 |
Translatable tabs for theme options form. Nov 27, 2017 |
1.0.1 |
Initialize plugin. Nov 13, 2017 |