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.
Use standards Drupal 8 translation.
Comment | File | Size | Author |
---|---|---|---|
#2 | feeds-change_translation_function-2865882-2-8x.patch | 2.72 KB | mgoncalves |
Comments
Comment #2
mgoncalves CreditAttribution: mgoncalves at CI&T commentedComment #4
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedUsing
t()
isn't strictly wrong, this function is not deprecated, but it is encouraged to not use it when possible. The reason behind replacingt()
with something else is to make it unit testable.$this->t()
cannot be used in static functions. Instead a new TranslatableMarkup object should be created.The PubSubHubbub class does not have a
t()
method. In order to get one, it should use the StringTranslationTrait.Comment #5
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedIf applying the best practises anyway, the PubSubHubbub class should also get the string translation service injected. This service can be passed by specifying it in feeds.services.yml: add an argument for the service 'feeds.pubsubhubbub'.
Comment #6
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedComment #7
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedComment #8
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedThis got fixed in #3021003: use function t() on EventSubscriber/PubSubHubbub.php.