4.2.2.2 Numeric, Monetary, and Metric
Description
Numbers are commonly displayed using the Arabic numeral system; that is, digits 0-9. However, the convention to group the
digits of a number varies from one culture to another. For example, in the U.S., a comma is used to separate digits into groups of
three, for example, 10,000,000, whereas in France, the separator is a dot. In Japan, digits are separated into groups of
four.
The convention for displaying monetary value varies from one country to another; that is, the currency symbol and the
position of the currency symbol. For example, to represent 5 US dollars and 45 cents, you place the dollar symbol before the
value--$5.45. In some locales, the currency symbol can appear after the value or even between the integral and fractional designations; for example, Portuguese 5$45 represents 5 escudo and 45 centavos.
Units of measurement can also vary from one locale to another. Standard metric units for length, volume, and weight include
meters, liters, and grams. Standard imperial units include feet, ounces, and pounds. However, there are other region-specific
measurements: Clothing sizes change from region to region; for example, a U.S. ladies' dress size 10 is a U.K. size 14 and a U.S.
ladies' shoe size 8 is a European size 39. Paper sizes change, packaged quantities change, temperature scales change--anytime there is a measurement unit involved, it is likely to vary in different locales.
Command Line Interface
A provider receives a value from a consumer, and either receives the locale as well or retrieves it from elsewhere in the
application or system. The provider then parses the data, supplying an internal format for processing or a locale-specific format for
output. In some cases, the actual format is provided by the consumer module. Most numeric formats can appear in a command line, though
in some cases, unit symbols are not available.
Character Interface
A character interface takes positioning into account, as well as the basic formatting necessary for command line. For
example, the decimal position for monetary units might be separate from the numeric portion for the display. For metrics, the unit names can precede or follow the value, and so the interface is flexible enough to accommodate field swapping.
Graphical Interface
In a graphical interface, flexibility for positioning and input is built in, similar to that of a character interface. Some
graphics might be used to represent units, although this costs more to localize. As in command line, a provider takes in locale and
value information and parses the data accordingly. A consumer supplies the provider function with the necessary data for
processing.
Application Protocols
An application protocol can include fields for the value, as well as for the unit, or specify the unit so that the value is
converted before it is passed using the protocol.
Storage and Interchange
Values might be stored in an internal format using a single unit for all stored values along with a conversion factor.
Values can also be stored in an internal format along with their corresponding units. For example, dimension measurements in an
application can be stored in meters, regardless of what units were originally entered. A set of conversion tables are then tied to the
conversion process. However, product prices can be stored in their original currency and have a currency unit associated with
each value.
Application Programming Interfaces (APIs)
APIs can include different combinations of parameters to allow proper numeric formatting. Sometimes the combination of value and locale is sufficient, sometimes a format mask or template is needed. Units might need to be specified as well. A flexible interface provides the most functionality, since many numeric formats are undefined.
Requirements for Compliance
Command Line Interface
Providers must supply functions that take locale into account along with a given value for input or output processing. If
necessary for proper processing, the provider functions must also accept unit and format parameters.
Consumers must provide the necessary information to provider functions. They must not override provider
functionality.
Character Interface
Providers must supply flexibility in field positioning, as well as numeric formatting functionality. See the command line interface requirements.
Consumers must lay out the interface to accommodate varying numeric formats and provide the necessary information to
provider functions.
Graphical Interface
Providers must supply layout and numeric formatting flexibility, similar to that of the character interface.
Consumers must:
- Provide a flexible layout for varying numeric format.
- Supply provider functions with required information for proper numeric formatting.
- Keep graphic representations of units to a minimum.
Application Protocols
Providers must ensure that the protocol includes information necessary for proper numeric formatting.
Consumers must provide the necessary information in the protocol.
Storage and Interchange
Providers must supply a mechanism for the storage of values, which either:
- Converts them to a standard format using a standard method
- Retains enough information associated with the value to ensure that it can be properly formatted when retrieved
Consumers must store the values according to provider specifications.
Application Programming Interfaces
Providers must supply locale-specific functions to format numbers, currency, and metrics. The APIs must be flexible enough to allow for custom formats.
Consumers must supply the required information to the provider APIs.
|
|