🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2833

Re: Printing plural forms.

#2833
From: Dick Dunn
Date: Tue, 26 Feb 1991 01:21
22 lines
1567 bytes
browns@iccgcc.decnet.ab.com (Stan Brown) writes:
> > arndt@zyx.ZYX.SE (Arndt Jonasson) writes:
[about annoying program output]
> >> 	1 files were copied
> >> when it should have been:
> >> 	1 file was copied

>        printf("%d file%s copied\n", nfiles, nfiles=1?" was":"s were");
> This assumes that "0 files were copied" is correct.  For that reason, and
> because it's less susceptible to bonehead errors like mine, I prefer the
> second form, which gives "files copied: 0", "files copied: 1",...

Your second form ("files copied: n") is better for another reason: It will
prevent much tearing of hair if anyone attempts to translate the messages
to another natural language.

The ?: singular/plural hacks calling printf are cute for programs which
don't travel much, but they don't translate.  There's generally no hope for
any sort of automated rework, either.
-- 
Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...But is it art?
Technical Details
Message-ID: <1991Feb26.012135.6029@ico.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!rpi!ispd-newsserver!ism.isc.com!ico!rcd
References: <1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3404.27c905aa@iccgcc.decnet.ab.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!rpi!ispd-newsserver!ism.isc.com!ico!rcd
From: rcd@ico.isc.com (Dick Dunn)
Newsgroups: comp.lang.misc
Subject: Re: Printing plural forms.
Summary: avoid them
Message-ID: <1991Feb26.012135.6029@ico.isc.com>
Date: 26 Feb 91 01:21:35 GMT
References: <1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3404.27c905aa@iccgcc.decnet.ab.com>
Organization: Interactive Systems Corporation, Boulder, CO
Lines: 22