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 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 commentedAdded docs to http://drupal.org/node/213368
Comment #4
nancydruI saw that. Thank you.
Committed to both branches.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
jpmckinney commentedThe following:
overwrites the
$pluralvariable used earlier in thepluralize_enfunction.Also, the
foreachshould beforeach ($irregular as $singular => $plural), based on the format of$irregular.Same goes for the
singularize_enfunction. Here is a patch to fix that.Comment #7
ice5nake commentedpluralize_en is currently returning false in development version when it should not.
Comment #8
moonray commentedMight this have to do with multi-byte characters?
Comment #9
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.