4.2.3.4 Other Formatting and Layout
Description
Computer applications process and format structured data to simplify tasks for users. For example, a business letter
wizard in word processing software requests a sender and receiver address and then formats them into a business letter
automatically, before the user even types a word. Applications should be aware that such formatting methods can be
culture-specific. A provider is expected to have a set of interfaces to format and process structured text. A consumer deals
with abstract text values. A provider also makes culture-specific formatting transparent to a consumer. For most of the
formatting issues listed in previous sections, an application might just fill a consumer role. The provider might be the
underlying operating system or a standard library. If an application intends to perform text formatting other than that which is
available from an external provider, then it must play the role of provider as well as consumer. Applications can use the
following steps to format structured data that is not listed in previous sections of this document.
- Verify that the formatting is language-specific or country-specific. If the formatting is not sensitive to any
language or country that the application is intended for, application designers can skip the following steps.
- Identify all languages and countries that the application is intended for.
- Define the provider interface. The interface should be abstract enough to handle all the formatting differences
between languages.
NOTE: The consumer makes no assumption about format. It represents abstract data and the
provider handles the formatting.
Consider, for example, the paper sizes that a printer recognizes. The application provides a choice of paper sizes in
response to a request to print a document. Standard paper sizes vary from one country to another. The consumer application should
be configured to print the document on any given paper size. The provider supplies all the paper sizes allowed for a given locale
to the consumer. The consumer then takes the size from the provider and formats the data.
Command Line Interface
All data that a user enters is in some format. For non-technical commands, the input data is often in a
locale-specific format. A locale-specific format might also be required for output data.
Character Interface
See "Command Line Interface."
Graphical Interface
In a graphical interface, the data is layed out on the screen. Many layouts are locale-specific, whether it is due to
the data itself or the layout in general.
Application Protocols
Application Protocols used to transmit data often require the data to be in a specific format. The protocol can be
used to parse the data, at least partially.
Storage and Interchange
For storage, a single internal format is typically used, with some form of locale indicator for data. This is to
enable data formatting on retrieval. Interchange is similar to application protocols. See "Application Protocols."
Application Progamming Interfaces (APIs)
APIs take in data for processing and return the data. If the data comes in in a locale-specific format, the API must
be locale-sensitive to ensure that the format is understood and the data can be correctly parsed. For output data, APIs can do
either of the following:
- Publish whether the data is formatted according to the locale
- Provide one format and expect the calling application to reformat for the locale
Requirements for Compliance
The interface between the provider and consumer must be locale-independent. If an application were to be extended to
handle a new formatting procedure, the provider must be able to extend the functionality without changing any interface between
the provider and consumer.
Command Line Interface
Determine whether data input and output formats are locale-specific. If they are, then locale-sensitive
interfaces must be built into the application. Since this type of data is less common, provider software or libraries might not
be available; therefore an application must function as both a provider and consumer.
Character Interface
See "Command Line Interface."
Graphical Interface
Make layouts flexible for rearrangment based on locale. Determine whether there are sufficient fields for display
for all supported locales.
Application Protocols
Allow for specification of locale, charset, or other related information necessary to correctly parse the
data.
Storage and Interchange
To enable data to be retrieved and changed into the correct locale format, store locale information with the data.
Interchange is similar to application protocols. See "Application Protocols."
Application Programming Interfaces
Consumers should supply locale information to providers to either accompany supplied data or to retrieve properly
formatted data. Providers must provide locale-sensitive interfaces to allow for varying locale formats.
|
|