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.
'#empty' => $this->t('There is no @label yet.', ['@label' => $this->entityType->getLabel()]),
In practice: "There is no Product yet."
We've had this since the early days, and in the meantime entity types got plural labels, allowing us to say "There are no products yet." instead.
So, let's do that.
Comment | File | Size | Author |
---|---|---|---|
#28 | interdiff-2942588-23-28.patch | 4.93 KB | chr.fritsch |
#28 | 2942588-28.patch | 7.53 KB | chr.fritsch |
#23 | 2942588-23-D8.patch | 7.59 KB | mohit1604 |
#23 | interdiff.txt | 967 bytes | mohit1604 |
#20 | 2942588-20-D8.patch | 8.25 KB | mohit1604 |
Comments
Comment #2
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #3
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commented@bojanz , Thanks for the issue , uploading required patch , please review it :)
Comment #5
tstoecklerHey @Mohit Malik: Thanks for creating the patch. In addition to changing the message you should also change the actual variable to use
$entity->getPluralLabel()
.And apparently there are a number of tests for this string, so you have to update those as well to match the new string.
Comment #6
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #7
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedUploading required patch , please review it :)
Comment #9
tstoecklerThanks @Mohit Malik. The patch looks better now. As you can see a number of automated tests fail, though, because they expect the old strings. So you have to update the tests, as well. If you look at https://www.drupal.org/pift-ci-job/882911 you can see a list of all the failures. For example
ActionListTest::testEmptyActionList()
asserts that there is a string "There is no Action yet." on the page. But with the patch the string is now "There are no actions yet." so you should update those.Comment #10
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #11
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #12
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commented@tstoeckler, Thanks for reviewing the patch. Uploading patch with changes mentioned in #9, please review it :)
Comment #14
joshi.rohit100@mohit-malik this should be like for example -
There are no action entities yet.
Check
Drupal\Core\Entity\EntityType::getPluralLabel()
Comment #15
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #16
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #18
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #19
joshi.rohit100still missing the #14
Comment #20
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedDid changes as per #14, please review it :)
Comment #22
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedComment #23
mohit1604 CreditAttribution: mohit1604 at Google Summer of Code commentedFixed test, hope it shows green ;)
Comment #24
hchonovInstead of using the default we should define the plural label on all those entity types.
Comment #25
bojanz CreditAttribution: bojanz at Centarro commentedRevived #2702683: Add plural labels to entity types, let's get that in first.
Comment #26
chr.fritsch#2702683: Add plural labels to entity types landed. So unblock
Comment #28
chr.fritschFixing tests
Comment #30
tstoecklerYay, thanks for the updated patch!
Comment #31
alexpottGranting review credit to everyone.
Comment #32
alexpottCommitted 27c8064 and pushed to 8.6.x. Thanks!
Comment #35
daniel.nitsche CreditAttribution: daniel.nitsche as a volunteer and at Modules in Depth commentedThis looks like an improvement, so great work there thanks. However, should this not conform to the user interface standards? Specifically:
https://www.drupal.org/docs/develop/user-interface-standards/table#empty
Happy to open a separate issue, I just thought it was worth mentioning here because core (URL alias screen, content types screen, custom block library screen etc.) seems to follow the standards, while contrib (Pathauto, Webform, Paragraphs) use EntityListBuilder::render(), so there is an inconsistency here.
Happy to open a separate issue if needed.