Ambiguity of Language in the Platform SDK

by Michael S. Kaplan, published on 2005/07/16 11:30 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/07/16/439603.aspx


A few weeks ago, Ivo asked in the microsoft.public.win32.programmer.international newsgroup:

I was wondering what is the point of the LeadingZero member in NUMBERFMT and CURRENCYFMT. The fact is that GetNumberFormat and GetCurrencyFormat do not have an argument to specify the width of the output, just the size of the buffer. Leading zeros only make sense if I can specify the width of the result somehow. I tried passing GetNumberFormat a source string with leading zeros, but it just ignores them regardless of the LeadingZero flag in NUMBERFMT.

The fact is that the LOCALE_ILZERO LCTYPE in GetLocaleInfo and the LeadingZero member of the CURRENCYFMT and NUMBERFMT structures (used by the GetCurrencyFormat and GetNumberFormat functions, respectively) are described in a way that can easily lead a reasonably intelligent developer to come to the same conclusion that Ivo did:

NUMBERFMT.LeadingZero
Specifies whether to use leading zeroes in decimal fields. This is equivalent to the locale information specified by the LCTYPE constant value LOCALE_ILZERO.

CURRENCYFMT.LeadingZero
Specifies whether to use leading zeroes in decimal fields. This is equivalent to the locale information specified by the LCTYPE constant value LOCALE_ILZERO.

LOCALE_ILZERO
Specifier for leading zeros in decimal fields. The maximum number of characters allowed for this string is two. The specifier can be one of the following values:
0 No leading zeros
1 Leading zeros

Now the meaning of the LOCALE_ILZERO flag (which, as the documentation for the structs states, applies to both the number and currency formats -- LOCALE_ILMONZERO is all about months, not money!) is not giving permission for there to be numbers like 0000.50.

It is meant to distinguish between .50 and 0.50. It is to allow the often locale-specific preference for one form or the other to be expressed for a given number. Note the plural forms on both sides of the sentence:

Specifies whether to use leading zeroes in decimal fields

Yes, it does talk about multiple zeroes. But it also is talking about multiple numbers. It only means to imply one leading zero per number, a fact that is easy to not see, even if English is one's first language (if it is not then there are even more reasons to possibly not get the admittedly unclear implied message here).

So I think we can all agree that the language is ambiguous here. Even if you understood the meaning yourself, you can almost certainly see the alternate interpretation and how someone might think that is the meaning.

It would be interesting to see if there is some pattern in the way people interpret the text, and whether it correlates with their original native language. It would also be fascinating to know what translated versions of the Platform SDK say here -- whether the localizer made the same mistake in interpretation, or whether they let the same ambiguity span the language barrier and exist in the localized version.

On the other hand, it would be fascinating to know if there were localized versions of the Platform SDK (all of the ones that ship with various language versions of products seem to be in English; I guess they dodged that bullet!).

 

This post brought to you by "ريال" (U+0631 U+064a U+0627 U+0644, a.k.a. Rial as in the Iranian Rial)
a currency that seldom requires one to care about leading zeroes since the currency values are generally not fractional


# Luke on 16 Jul 2005 1:45 PM:

Reminds me of an exam question given by one of my physics professors, something like "what is the probability that electron A is farther from the nucleus than electron B?" Most of the students drew a mental boundary line at B, but some drew their line halfway between the nucleus and B; the former thought "...than electron B is" while the latter thought "...than from electron B."

# Michael Dunn_ on 17 Jul 2005 7:57 PM:

The only language I know well enough to talk about is French, but the rule for using a singular/plural noun in that case is different than the English rule. In French, when you write "noun1 [preposition] noun2", noun1 is plural only if each noun2 has multiple noun1s. So a native French speaker could easily infer that "leading zeroes in decimal fields" means each field has multiple zeroes.
This ambiguity could be resolved by writing "Specifies whether to use a leading zero in decimal fields" which is still correct in English and will lead a French speaker (doing a mental word-for-word translation) to the correct conclusion.

# Michael S. Kaplan on 17 Jul 2005 10:12 PM:

Hmmm... clarity of concept in *two* languages. Cool. :-)

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2012/05/22 Special casing of locale specific number formatting....

2007/06/02 Objection, managed code! That zero is leading!

go to newer or older post, or back to index or month or day