[PATCH 1 of 2] templating: fix age() function to return 1 minute, 1 hour, 1 day etc
Matt Mackall
mpm at selenic.com
Thu Jan 5 22:28:54 UTC 2012
On Thu, 2012-01-05 at 16:30 +0100, Martin Geisler wrote:
> Matt Mackall <mpm at selenic.com> writes:
>
> > 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.
>
> It sounds like a misunderstanding here: you don't need to know the rules
> for all languages, you just need to come up with singlular and plural
> strings for *English*.
Previously discussed. Patches seen and rejected.
> The translators will then have to deal with the two or more cases there
> exist for their favorite language.
>
> > Code like plural() is hopeless. Yes, ngettext exists, but it means
> > educating way too many people about these complexities for basically
> > negligible gain.
>
> I'm sorry to say this, but that's a quite English-centric point of view.
> Yes, many languages have only two forms and so always using the plural
> form works well -- it only fails when you have '1 years.
>
> But for languages where there is a difference between '2 years and '5
> years', it looks strange when the wrong form is used.
Previously discussed.
> > 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.
>
> Maybe we could let the English translation use the plural form always
> (like today) when HGPLAIN is set? That makes it easy for computers to
> parse the output, while providing nice output for humans.
Previously discussed.
> I'm not sure if that was what Andrei already suggested in his ngettext
> patch, but it would be something like:
>
> if os.environ.get('HGPLAIN'):
> def ngettext(singular, plural, count):
> # always use English plural text for easy parsing by witless
> # morons (computers).
> return plural
> else:
> def ngettext(singular, plural, count):
> # call tungettext, encode as necessary
>
> > So we have a choice between potentially crucial scripts falling after
> > doing more work and annoying language pedants with less work. Pedants
> > lose.
>
> We could even turn of translations when stdout is not attached to a TTY.
> But maybe it would be too confusing for a Russian sysadmin that the
> output changes like that depending on how the script is executed.
Previously discussed.
> On the other hand, I'm not sure that translators have kept the output as
> stable as we keep the English output. That is, if they made sure to pick
> a good word for 'changeset' at the beginning and never changed their
> minds.
>
> Finally, words that were introduced late (like 'bookmarks') must have
> changed from English to a native language as translators got around to
> translate them. So grepping for specific English words can suddenly fail
> when a new stable version is released with better translations. This is
> yet another reason why people must use HGPLAIN when interfacing with
> Mercurial in scripts.
You know I hate repeating myself, so you must be trolling me.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list