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.
Problem/Motivation
coder has some useful rules for preventing issues with translatable strings. Let's turn some on in the core ruleset.
Proposed resolution
Enable some of the t() semantic rules.
How to review:
$ composer require drupal/coder
$ ./vendor/bin/phpcs --config-set installed_paths /PATH/drupal/vendor/drupal/coder/coder_sniffer/
$ cd core
$ ../vendor/bin/phpcs -p
...with no errors.
Remaining tasks
User interface changes
Some broken strings are fixed. Because strings are changing this is only eligible for 8.2.0.
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#5 | 2710201-5.patch | 8.35 KB | andypost |
Comments
Comment #2
alexpottComment #3
Mile23The patch looks good except for this one typo. Mmmm, string beans! Should be 'string being.'
Comment #4
alexpottI've run the updated ruleset with #2710209: The FunctionT sniff needs to support TranslatableMarkup and TranslationWrapper too applied so adding a fix for the one thing that that found.
Comment #5
andypostreroll, looks good
remains are
Comment #6
alexpottCommitted b864a3a and pushed to 8.2.x. Thanks!
Unfortunately we can't have this in 8.1.x because of the string changes.