Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
Labels defined in a module's module.layouts.yml are not translatable.
Proposed resolution
N/A
Remaining tasks
Make labels (and possibly other strings defined in module.layouts.yml) translatable.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#23 | 3008772-22.patch | 8.77 KB | andypost |
#23 | interdiff.txt | 2.17 KB | andypost |
#21 | interdiff.txt | 771 bytes | andypost |
#15 | 3008772-15-test-only.patch | 6.36 KB | andypost |
Comments
Comment #2
andypostI think it should be broader issue to allow define translatable properties in annotations
Comment #3
andypost\Drupal\Core\Layout\Annotation\Layout
defines label & description as@ingroup plugin_translatable
but actually it makes it translatable as https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/transla... supposedComment #4
andypostLet's see how many tests will fail
Comment #5
andypostAlso region names needs wrapper somehow
Comment #7
andypostA bit cleaner patch
Comment #8
andypostFix test
Comment #9
andypostLooking deeper it looks like
\Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator
should be able to detect properties that are translatableAlso reflection of properties annotations could bring overhead of yaml discovery
Comment #10
tim.plunkettFirst of all, this needs tests.
Second, this should (ideally) work.
Comment #12
andypostThere's no BC break according https://www.drupal.org/core/d8-bc-policy#public-properties because
\Drupal\Core\Layout\LayoutDefinition
has no interfaceComment #15
andypostFix #10 s/title/label and extended tests
Comment #17
johnzzon#15 worked for me!
Comment #18
tim.plunkettThanks @andypost!
I believe breakpoint.module suffers from the same oversight, another issue should be opened for that module and any others using \Drupal\Core\Plugin\Discovery\YamlDiscovery
Comment #19
johnzzonComment #20
andypostFiled follow-up #3009291: Fix remaining untranslatable properties from YAML discovery
Comment #21
andypostAt least region names should have own translation context
I did not add "context_key" argument to
addTranslatableProperty()
because it used in a strange way in\Drupal\Core\Plugin\Discovery\YamlDiscovery::getDefinitions()
Comment #23
andypostAnd fixed test
Comment #24
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThis is an accessibility must-have. We'll need to use layout/region label/description to describe various aspects of the layout builder UI to screen reader users.
Comment #25
tim.plunkettNot sure what this has to do with accessibility, but I'll take your word for it :)
Comment #27
larowlanCommitted 1b186cf and pushed to 8.7.x. Thanks!
C/p as 090bbaea43 and pushed to 8.6.x