Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm aware of issue #2725453: Refactor widget plugins by adding interface, base class, schema, but I thought others could benefit from this patch. It just puts the output of the default option label through the t-function when building the dropdown widget.
To be clear; this does not apply when rendering the configuration form, this will always hold the original string.
Do you need a test? Personally, I think this is out of scope because the StringTranslationTrait has already been tested.
Comment | File | Size | Author |
---|---|---|---|
#6 | translatable_default_option_label.patch | 1022 bytes | matteodem |
facets-trans_option_label-1.patch | 801 bytes | lammensj |
Comments
Comment #2
borisson_I don't think we need to test this, this looks good. Thanks!
Comment #3
borisson_Thanks!
Comment #6
matteodem CreditAttribution: matteodem commentedThe text is not translatable in the latest version. Here's the patch to fix it.
Comment #7
pfrenssen@matteodem the original fix was not correct and it has been removed again. Dynamic strings should never be passed through
$this->t()
.The label can be translated in the standard way by enabling the Config Translation module.