Singular/Plural nouns

86 views
Skip to first unread message

bonna...@hotmail.com

unread,
Nov 3, 2014, 6:40:59 AM11/3/14
to tangl...@googlegroups.com
I previously build a site with food recipes. Here users could change the number of people/serving size, and the list of ingredients would update correspondingly. Functionality much alike Tangle. I spend some time trying to get singular and plural nouns correct. The simple solution I ended up using was adding a little extra HTML markup (and JS). Something like this (using the example from the frontpage):

Case plural: When you eat 3 cookies, you consume 150 calories.
Case singular: When you eat 1 cookie, you consume 1 calorie.

HTML
When you eat <span data-var="cookies" class="TKAdjustableNumber"> <span data-s="cookie" data-p="cookies">cookies</span></span>, you consume <span data-var="calories"> <span data-s="calorie" data-p="calories">calories</span></span>.

Where the attribute data-s="cookie" contains the singular noun and is used when this.cookies < 2 and the attribute data-p="cookies" contains the plural noun, and is used when this.cookies ≥ 2. And correspondently for this.calories. Why 2? Well you say ½ cookie, 1 cookie, 1½ cookie, but say 2 cookies, 3 cookies, etc. The solutions is not perfect – language is tricky and not always that logical. I.e. you would must likely also say 0 cookies. And furthermore these "rules" depend on which language we are talking about; English, Danish, German, or a third.

Perhaps the above mention approach could be of interest. Feel free to use any or all of it.
Best regards
Jonas


PS: Regarding decimals, fractions and rounding of numbers (https://groups.google.com/forum/#!searchin/tangle-talk/decimal/tangle-talk/aJL0SZhaids/orwD3UGKhz0J). My approach was to use a combination. The underlying assumption was that users had a better understanding when numbers were presented as fractions rather than decimals, i.e. rather than 0.333, and instead of 3.333 I would use 3⅓ or just 3 (I think that up until 10 I used the fraction, above 10 i ignored any decimal). BUT only up until a certain threshold "fractional level", i.e. people have a poor understanding of , so here I might instead have used 0.375 or approximated it to
I found inspiration in http://www.mindspring.com/~alanh/fracs.html Here the first 4 lines/approximations/fractions for any decimal number (<1) are fairly easy for must people to comprehend. So I would present one of these.

Reply all
Reply to author
Forward
0 new messages