Article View: comp.lang.misc
Article #2846Internationalization [was Re: Printing plural forms.]
From: David Wolverton
Date: Tue, 26 Feb 1991 22:49
Date: Tue, 26 Feb 1991 22:49
40 lines
2325 bytes
2325 bytes
In article <3433.27ca3674@iccgcc.decnet.ab.com>, browns@iccgcc.decnet.ab.com (Stan Brown) writes:
> >> We all have seen and, in various degrees, been irritated by texts such
> >> as:
> >> 1 files were copied
> >> when it should have been:
> >> 1 file was copied
> >>
> >> I'd like to know: when programming, how do you avoid such errors?
> ...
> Which all goes to show: simpler is better. The "files copied: %d" version
> has been error free since the beginning--as far as I know.
As an addendum to this discussion, you might consider how these sorts
of problems occur when a program is internationalized (that is, converted
into another language) (that is, a human language other than English).
A truly "world class" (pun intended) programmer will consider such
issues during development.
As an example of the kind of problem that you can get into,
consider a printf() like this:
printf("Your account balance on %s is %s\n", balance, date);
Assuming that you pull the 1st argument out into a #define in a header
or a text file somewhere, at least the following other issues come up:
1. How to print the correct currency symbol?
2. How to format values > 999?
3. How to format the date?
4. Whether, in a language other than English, would
the message read more sensibly with the second and
third printf() arguments reversed?
The ANSI C standard library (in a hosted implementation)
addresses the first three points [Doug, no need to respond
on those points unless I've screwed something up], but not the last.
HP's prinf() family contains some extensions for this purpose.
I'm not aware of any other vendor that has attacked this issue.
Dave Wolverton
David.Wolverton@att.com
...!att!honshu!daw
Technical Details
Message-ID:
<1991Feb26.224900.2283@cbnewsh.att.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!dawReferences:
<1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3433.27ca3674@iccgcc.decnet.ab.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!daw From: daw@cbnewsh.att.com (David Wolverton) Newsgroups: comp.lang.misc Subject: Internationalization [was Re: Printing plural forms.] Message-ID: <1991Feb26.224900.2283@cbnewsh.att.com> Date: 26 Feb 91 22:49:00 GMT References: <1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3433.27ca3674@iccgcc.decnet.ab.com> Organization: AT&T Bell Labs, Holmdel, NJ Lines: 40