Allow field and option labels from yml to be translatable

Created on 10 October 2024, about 1 month ago

Problem/Motivation

We use style_options and layout_paragraphs on a multi-language sites factory, it's really efficient and allow us to propose a lot of layout and behaviors for contributors.

I see that style_options yml labels for fields and options are not translatable. The module layout_paragraphs is based on the core layout library, using the LayoutPluginManager which allow region and label to be translated.

Steps to reproduce

  • Install a fresh drupal site with english language and paragraphs.
  • Activate a second language of your choice.
  • Add a field_paragraphs field to page bundle.
  • Install and activate style_options module.
  • Define a custom style_options.yml file with label and options in english, enabled on field_paragraphs.
  • Change admin language to french

The style_options fields and values are not translated.

Proposed resolution

Add a TranslatableMarkup conversion in StyleOptionPluginManager, as it is done in LayoutPluginManager, for all labels from the yml files.

Remaining tasks

Propose an adapted solution.

User interface changes

Translation of the contribution form.

API changes

None.

Data model changes

Probably getLabel method will have a change in definition.
Otherwise I do not know.

Feature request
Status

Active

Version

1.1

Component

User interface

Created by

🇫🇷France ccrosaz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024