Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Matt Mackall <mpm <at> selenic.com>
Subject: Re: [PATCH 1 of 2] templating: fix age() function to return 1 minute, 1 hour, 1 day etc
Newsgroups: gmane.comp.version-control.mercurial.devel
Date: Monday 19th December 2011 22:22:11 UTC (over 5 years ago)
On Tue, 2011-12-20 at 04:56 +0700, Andrei Polushin wrote:
> 20.12.2011 4:20, Matt Mackall wrote:
> > On Mon, 2011-12-19 at 06:58 +0700, Andrei Polushin wrote:
> >>
> >> The existence of plural() function earlier in code show the intent to
make
> >> singular/plural forms, while the condition '>= 2' disables all
singular forms
> >> other than '1 second'.
> > 
> > Incorrect. It merely demonstrates the developer who committed plural()
> > in hgweb (me, 23 May 2005) was not yet aware of our long-standing
policy
> > of avoiding the pointless complexity of pluralization. The vast bulk of
> > the code intentionally makes no effort to deal with pluralization and
> > we've rejected dozens of patches to fix "1 files" and other
> > pluralization special-cases.
> 
> That's a pity :(
> 
> First, pluralization is not pointless for Russians, compare:
> 
>   %d ignored file(s)              -- English
>   %d игнорируем(ый,ых) файл(а,ов) -- Russian has 2
or 3 possible forms
> 
>   %d year(s) -- English
>   1 год      -- Russian for 1, 21, 31 ... 101, 121 ...
>   2 года     -- Russian for 2, 3, 4, 22, 23, 24 ...
>   5 лет      -- Russian for other numbers (different word used!)

This is actually one of the reasons why we don't bother. The rules
change from language to language and basically no one knows all the
rules. Code like plural() is hopeless. Yes, ngettext exists, but it
means educating way too many people about these complexities for
basically negligible gain.

Note that only a witless moron could ever actually be confused (rather
than simply annoyed) by "1 files". Unfortunately, we actually deal with
these witless morons on a daily basis: they're called computers. And as
it happens, they're actually much more likely to be confused by the
difference between "1 file" and "2 files", especially if we were to
switch to using the latter 6 years in.

So we have a choice between potentially crucial scripts falling after
doing more work and annoying language pedants with less work. Pedants
lose.

> Second, it doesn't require too much effort, as long as only hard cases
need
> to be fixed.
> 
> I have only 4 small patches to fix major readability issues with plurals.
> 
> > Further, the >= 2 code is actually better from an accuracy point of
> > view. With it, we get results like "23 months", which is better than "1
> > year".
> 
> OK, that's a matter of taste. Sorry, I didn't get the intent right.
> 
> BTW, I would prefer 'n >= 1.5' condition to make it look like so:
> 
>   1 second .. 89 seconds,
>   1 minute .. 89 minutes,
>   1 hour   .. 35 hours,
>   1 day    .. 10 days,
>   1 week   ..  5 weeks,
>   1 month  .. 17 months,
>   1 year   ...
> 
> What do you think?

Now we do round-toward-zero, that would imply round-to-nearest. I think
I prefer the round-toward-zero mode.

-- 
Mathematics is the supreme nostalgia of our time.


_______________________________________________
Mercurial-devel mailing list
[email protected]
http://selenic.com/mailman/listinfo/mercurial-devel
 
CD: 5ms