Skip to content

Add Helper for Pluralization #1

jeresig opened this Issue May 16, 2011 · 2 comments

2 participants

Khan Academy member
jeresig commented May 16, 2011

Right now it's kind of annoying to work out the exact syntax for displaying if a word should be plural or not, for example right now you have to do:

<p>In total, she traveled <var>DIST</var> miles for <var>TIME</var> hour<var>TIME > 1 ? "s" : ""</var>.</p>

Perhaps that could be simplified to:

<p>In total, she traveled <var>DIST</var> miles for <var>TIME</var> <var>plural("hour", TIME)</var>.</p>
pappy74 commented May 23, 2011

I can work work on this.

I'm imagining three signatures:


return 's' if NUMBER is not 1

plural(NUMBER, plural_suffix)

return plural_suffix if NUMBER is not 1

plural(NUMBER, singular_version, plural_version)

return singular_version if NUMBER is 1, otherwise plural_version

Of course, this is very English-centric... is that ok for now?

pappy74 commented May 23, 2011

pull request submitted


@jeresig jeresig closed this in c86b807 May 24, 2011
@musicalglass musicalglass added a commit that referenced this issue Nov 16, 2011
@musicalglass musicalglass This should push us to #1 on most Search Engines
within 4 - 6 weeks.
Simply place the keyword_redirect folder
in the same folder as your main index page,
and post it onlne. The various web crawlers should pick
it up eventually, or you can draw attention
by simply submitting one of the pages in the folder
to each search engine. They will likely
automatically catalog the rest of the pages
This was referenced Aug 14, 2012
@spicyj spicyj added a commit that referenced this issue May 7, 2013
@spicyj spicyj Don't show 0-weight problem types in ex browser
Also change "0: horizontal" to "#1: horizontal" as well as changing "0: 0"
(with unnamed types) to simply "#1".

Auditors: eater
This was referenced Jan 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.