translate field_group description for detail & fieldset

Created on 27 March 2018, over 6 years ago
Updated 16 December 2023, about 1 year ago

I think it's a requirement to translate description on field_group. I add t function to the description.

hope that my patch can by used.

🐛 Bug report
Status

Closed: works as designed

Version

1.0

Component

Miscellaneous

Created by

🇧🇪Belgium noita

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 6 years later and this issue is till there!

    I tried to make the fields (title and description) translatable in my custom theme templates but could only make {{ description }} work by adding the `straptags` filter first and then `|t` ! For the title I had to `title['#markup']|t` .

    I'm not sure if this is a safe practice and don't like having to use the `striptags` filter so I tried the solution #4 🐛 translate field_group description for detail & fieldset Closed: works as designed suggested by @Peacog but am not that familiar with using config `yml` for translation as suggested.

    It would be so nice if you can give full and clear detailed instructions on how to :

    In the meantime you have to provide the configuration translation yourself by creating a file in your config/sync/language/LANGUAGE directory. The easiest way to do it is to find the config file for your default language, copy it to the directory for the language you are translating to, and remove everything except for the field group settings. The file will have the format core.entity_view_display.ENTITY_ID.VIEW_MODE_ID.yml

    In my case, I did a full config export and I copied the `core.entity_view_display.node.book.full.yml` then renamed it to `core.entity_view_display.field_group.yml`, kept only the parts for field_group in it and translated labels and descriptions in it, and add it to the newly created `config/sync/language/LANGUAGE directory` but couldn't see any effect of that! I then tried copying the content and paste into single import at /admin/config/development/configuration/single/import but wasn't sure which config type I should choose and failed with all I tried.

    Since this issue may take few more years to be solved by core as far as I understand it's why "Closed (works as designed)" then there should be a clear step by step agreed temporary solution.

  • 🇪🇸Spain Peacog

    What you did is not quite right @cestmoi. Assuming your field group is in the Book content type, the entity id is book. The new file you created in the LANGUAGE directory should be named either core.entity_form_display.node.book.full.yml if your field group is on the node edit form, or core.entity_view_display.node.book.full.yml if the field group is on the node view display.

    The file only needs to contain the parts relevant to the field group strings you want to translate e.g.

    third_party_settings:
      field_group:
        group_your_group_id:
          format_settings:
            label: 'The translated label'
            description: 'The translated description'
          label: 'The translated label'
    

    After that import the configuration with drush cim and you should see your translations.

  • Thank you @Peacog. I managed to finally import it and make it work after figuring out that I have to add the translations directly in the yml file rather than searching for it in Configuration Translation, User Interface Translation, or in the Content Type.

Production build 0.71.5 2024