Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!fuug!demos!avg From: avg@hq.demos.su (Vadim Antonov) Newsgroups: comp.lang.misc Subject: Re: Printing plural forms. Message-ID: <1991Feb26.161256.14202@hq.demos.su> Date: 26 Feb 91 16:12:56 GMT References: <1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3404.27c905aa@iccgcc.decnet.ab.com> <1991Feb26.012135.6029@ico.isc.com> Organization: DEMOS, Moscow, USSR Lines: 44 In <1991Feb26.012135.6029@ico.isc.com> rcd@ico.isc.com (Dick Dunn) writes: >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"); Think about us, poor Russians, I have to write something like: { char *p = "failov skopirovano"; if( n < 10 || n > 20 ) switch( n % 10 ) { case 1: p = "fail skopirovan"; break; case 2: case 3: case 4: p = "faila skopirovano"; break; } printf("%d %s\n", n, p); } Got the point? I've spent a hell lot of time making bilingual release of Unix (Russian and English) and finally I think it would be better to have a standard function for producing plural forms, something like: printf("%d file%s copied\n", n, plural(n, ":s", "english")); printf("%d fail%s skopirovan%s\n", n, plural(n, "ov::a", "russian"), plural(n, "o::o", "russian")); I have some ideas about how to handle plural forms and multilingual diagnostics on binary installations but it requires a lot of changes in compilers, languages, link editors and kernels. It's a long story but it is possible. Vadim Antonov DEMOS, Moscow, USSR