C has become an international language. Users of the language outside the United States have been forced to deal with the various Americanisms built into the standard library routines.
Areas affected by international considerations include:
In English, each letter has an upper-case and lower-case form. The German ``sharp S'', ß, occurs only in lower-case. European French usually omits diacriticals on upper-case letters. Some languages do not have the concept of two cases.
printf and scanf.
Prevalent practice in several major European countries is to use a comma;
a raised dot is employed in some locales.
Similarly, in the United States a comma is used to separate
groups of three digits to the left of the decimal point;
a period is common in Europe, and in some countries digits are
not grouped by threes. In printing currency amounts, the
currency symbol (which may be more than one character) may
precede, follow, or be embedded in the digits.
asctime returns a string which includes
abbreviations for month and weekday names,
and returns the various elements in a format which might be
considered unusual even in its country of origin.
Various common date formats include
1776-07-04 ISO Format
4.7.76 customary central
European and British usage
7/4/76 customary U.S. usage
4.VII.76 Italian usage
76186 Julian date (YYDDD)
04JUL76 airline usage
Thursday, July 4, 1776 full U.S. format
Donnerstag, 4. Juli 1776 full German format
Time formats are also quite diverse:
3:30 PM customary U.S. and British format
1530 U.S. military format
15h.30 Italian usage
15.30 German usage
15:30 common European usage
The localization features of the Standard are based on these principles:
setlocale function
setlocale provides the mechanism for controlling
locale-specific features of the library.
The category argument allows parts of the library to be localized
as necessary without changing the entire locale-specific environment.
Specifying the locale argument as a string
gives an implementation maximum flexibility in providing a set of locales.
For instance, an implementation could map the argument string into
the name of a file containing appropriate localization parameters
--- these files could then be added and
modified without requiring any recompilation of a localizable
program.
localeconv function
The localeconv function gives a programmer access to information
about how to format numeric quantities (monetary or otherwise).
This sort of interface was considered preferable to defining conversion
functions directly:
even with a specified locale, the set of distinct formats that can
be constructed from these elements is large, and the ones desired
very application-dependent.