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.
These are originally from http://www.phpclasses.org/browse/file/12343.html and work surprisingly well (considering the messiness of the English language!).
They were licenced under the LGPL, so I hereby relicensing this copy under the ordinary GPL according to section 3 of the LGPL ;)
http://www.opensource.org/licenses/lgpl-2.1.php
Comment | File | Size | Author |
---|---|---|---|
#6 | 300820-fix.patch | 2.45 KB | jpmckinney |
pluralize.patch | 3.85 KB | Owen Barton |
Comments
Comment #1
Owen Barton CreditAttribution: Owen Barton commentedBTW - these are based on the RoR inflector...
Also, code is cleaned up according to Drupal coding standards.
Comment #2
NancyDruThanks, Owen. Before I commit it, we do require an update for the documentation as well.
Comment #3
Owen Barton CreditAttribution: Owen Barton commentedAdded docs to http://drupal.org/node/213368
Comment #4
NancyDruI saw that. Thank you.
Committed to both branches.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
jpmckinney CreditAttribution: jpmckinney commentedThe following:
overwrites the
$plural
variable used earlier in thepluralize_en
function.Also, the
foreach
should beforeach ($irregular as $singular => $plural)
, based on the format of$irregular
.Same goes for the
singularize_en
function. Here is a patch to fix that.Comment #7
ice5nake CreditAttribution: ice5nake commentedpluralize_en is currently returning false in development version when it should not.
Comment #8
moonray CreditAttribution: moonray commentedMight this have to do with multi-byte characters?
Comment #9
noah CreditAttribution: noah commentedNot sure about the other stuff, but the overwriting issue noticed by jpmckinney is still a problem in the current development version. In this case using singularize_en, we've got:
By the time we get to "foreach ($singular as $rule => $replacement)" the value of $singular has already been overwritten by "foreach ($irregular as $plural => $singular)".
jpmckinney's patch fixes this issue.