|
4.2.1 Culture Negotiations, Defaults, and Selection
Description
Cultural conventions affect much of the data people see every day. Numeric formats, such as date or prices, addresses, even page layout can change from culture to culture. In order for an application to provide information in the format a user expects, appropriate cultural information must be accessible from somewhere. The determination of culture can be done by asking the user to choose, by a configuration setting in the application, or by detection of system settings. Settings can remain for a single object, a session, or until they are changed manually in a properties or configuration file.
In the language of software development, a culture is called a locale. Locale formats can vary from platform to platform, though there are some guidelines and de facto standards. Applications manage the translation from a software locale designation on one platform to that of another, to something which is understood by the user.
In this case, providers must supply a locale retrieval mechanism or environment setting. In addition to using provider locale determination, consumers might need to provide a method for the user to communicate a specific locale.
For more information, see "Translation Negotiations, Defaults, and Selection."
Command Line Interface
Command line functions can determine locale from the system, the environment, or as part of the command argument. Some command line functions use all three methods in a hierarchy of availability: If there is no locale argument, then check the environment. If there is no environment locale setting, then check the system. Other commands take an argument or fall back to a default locale.
Character Interface
Character interfaces lend themselves to two types of locale determination: The locale can be read from the system or configured as a user setting. Some interfaces have a fallback locale, which in some cases is configurable, for example, the command line interface.
Graphical Interface
Similar to character interfaces, the graphical interface usually provides a user-settable locale with some sort of fallback mechanism to a system or default locale.
Application Protocols
Protocols do not have the ability to query settings and so include explicit locale information as parameters.
Storage and Interchange
Storage and interchange, like protocols, cannot use system settings. One machine can store data in several locales, so the data must be stored with explicit locale information. Some data can be stored in a base format with locale-specific formatting determined by a user interface level. An example of this is dates; they are often stored in coordinated universal time (UTC) values and a specified base format. The user interface code then reformats the date into the locale of the current user who requests it.
Application Programming Interfaces (APIs)
APIs can require explicit locale information, use system or environment settings, or do both in hierarchical sequence.
Requirements for Compliance
Providers must supply structures or mechanisms for locale retrieval either from the environment or from system settings.
Consumers must use provider locale information, but should also provide as much flexibility to the user as possible. Product usability improves if you enable users to set their preferred locale.
Command Line Interface
Providers must supply an environment structure.
Consumers should allow for a user-specified locale and have a fallback to environment, system, and default settings.
Character Interface
Consumers should query the user and have a fallback or default locale. At a minimum, consumers must have a locale configuration setting.
Graphical Interface
Same as "Character Interface."
Application Protocols
Providers must allow for locale parameters in the protocol, where appropriate.
Consumers must supply locale information in the protocol.
Storage and Interchange
Providers must allow some method for explicitly stating the locale of related data or force the data into a published neutral format.
Consumers must supply locale information with data for storage or interchange and read the locale when retrieving the data. They must format the data according to locale, where appropriate.
Application Programming Interfaces
Providers must supply parameters for explicit locale inclusion, where appropriate. They must publish locale handling, such as fallback to an environment or system locale. It is strongly recommended that the locale parameter scope be limited to a thread or object.
Consumers must supply locale parameters, where possible, and handle fallback situations as published by providers.
|
|