Should there be support for them?
1 Onion
1-1/2 Onions
I'm not sure.
We could add a plural name into the ingredients table, or something cheesy like tacking on an 's'.
Right now you either see both as separate ingredients or you see "2 Onion" or the opposite, "1 Onions".
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 732654-enable-plural-units-9.patch | 1.51 KB | dcam |
Comments
Comment #1
scottprive commentedI don't see why not, but I strongly prefer the "cheesy" approach.. This really feels like a "presentation" issue.
"Quantity" and "ingredient/objects/things" are kept apart for some good reasons:
- discouraging duplication
- translation (although, there's no facility to do that at the moment, and this would be another issue entirely).
- regional variations... "0.5 onions" might be OK in en_US, this usage might make an en_GB user apoplectic because it is not "one-half onion".
FYI - some German users want the first letter of every ingredient capitalized (as they capitalize all nouns, not just proper nouns like we do). For us to support German that way, we would need to use something (like the language API or theme layer) to alter the first letter. This is just an different example, but it shares some of the same issues as English plurality.
Comment #2
jvandervort commentedYeah, as I look into it, I don't like adding a plural ingredient column.
Maybe we can do a little better than tacking an 's' with something like this:
http://www.phonicsontheweb.com/plurals.php
in conjunction with an admin setting for 'English plural rules' or something.
Maybe also with the 'Capitalize Nouns settings."
Comment #3
scottprive commentedThe rules for English are complex. What do you expect when you mash together French, Dutch, Latin and German? There's probably a reason that plurality/singularity services are not provided already by Drupal's i18n or theme layers. It's difficult.
And what if the ingredient I was adding was "hops"? that one is rarely seen as singular. :-)
But I think you hit on something here - ingredients stored in both plural and singular.
Presumably, a best practice for a Drupal editor would be to minimize this through moderation and editing of recipes.
Or maybe I would be the only person who would obsess over that.
So one approach would be:
Admin bulk search and replace within all recipes - s/onion/onions/ for example.
Additionally, this approach would work in all languages not just 1.
Another approach is a finer permissions level, where new recipes are marked unpublished IF they contain any newly added ingredients.. the site admin might want to approve new ingredients, to keep the data fragmentation low.
Comment #4
jvandervort commentedYeah, English is complex, but using basic rules + exceptions would get you close without too much heartache.
You could normalize to singular and apply pluralize when the quantity required. It wouldn't be 100%, but currently
it is not 100% correct either. Of course we would make sure barley, malt, and hops were handled correctly:)
Comment #5
csc4 commentedCould we not just add another field used for display when quantity <> 1?
Comment #6
fang27 commentedHow about plurals when it comes to units of measure? i.e. Instead of:
2 Cup Sugar
1-1/2 teaspoon salt
We need to see:
2 Cups Sugar
1-1/2 teaspoons salt
When the ingredients are over any unit of 1?
Comment #7
dcam commentedI've been working with the Recipe module for the last few months on a project and the units always being singular is an issue that was just reported to me. I'm pretty certain that the module is written so that the units are supposed to be correctly singular/plural though, meaning this is a bug. I haven't looked into it yet so I don't have a solution. When I do I'll come back and post an issue.
As for the ingredient name singular/plural issue, the same client also just asked why this wasn't possible. I advocated the moderation suggested by tzoscott in #3, but they may ask me to provide this functionality anyway. I haven't come up with a good programmatic solution yet either. From my perspective, there's another issue with adding a plural name field in that you also have to choose which name, singular or plural, should be used when the ingredient has a unit. It could be either one, for example "1 cup onion" or "1 cup cherries". So another field might have to be added just to pick which name should be used when the ingredient has a unit.
Comment #8
cmurph commentedI've included a fix for the singular/plural issue stated here into my patch for the following issue... Take a look at that for a fix: Patch which includes singular/plural addition
Comment #9
dcam commentedI moved this to the 7.x-1.x-dev branch which is what both cmurph and myself patched.
I happened to patch the plural unit issue in a theme override for a project a few weeks ago, but forgot to contribute it. The attached patch takes a slightly different approach to #8. The units are plural whether the full name is printed or if it's in the title property.
Comment #10
jvandervort commentedCommitted unit plurals patch.
Leaving this open for ingredient name plurals.
Comment #11
jvandervort commentedComment #12
jvandervort commentedComment #14
dcam commentedSince Drupal 7 is now end-of-life I am closing some old issues for the 7.x branch of this module.
Comment #15
dcam commented