tango.text.locale.Locale

Members

Classes

Culture (from tango.text.locale.Core)
class Culture via public import tango.text.locale.Core : Culture;

$(ANCHOR _Culture) Provides information about a culture, such as its name, calendar and date and number format patterns. Remarks: tango.text.locale adopts the RFC 1766 standard for culture names in the format <language>"-"<region>. <language> is a lower-case two-letter code defined by ISO 639-1. <region> is an upper-case two-letter code defined by ISO 3166. For example, "en-GB" is UK English.

There are three types of culture: invariant, neutral and specific. The invariant culture is not tied to any specific region, although it is associated with the English language. A neutral culture is associated with a language, but not with a region. A specific culture is associated with a language and a region. "es" is a neutral culture. "es-MX" is a specific culture.

Instances of DateTimeFormat and NumberFormat cannot be created for neutral cultures.

Locale
class Locale

Locale-enabled wrapper around tango.text.convert.Layout

Functions

main
void main()

Meta

License

BSD style: $(LICENSE)

Version

Feb 2007: Initial release

Authors

Kris

This is the Tango I18N gateway, which extends the basic Layout module with support for cuture- and region-specific formatting of numerics, date, time, and currency.

Use as a standalone formatter in the same manner as Layout, or combine with other entities such as Stdout. To enable a French Stdout, do the following:

Stdout.layout = new Locale (Culture.getCulture ("fr-FR"));

Note that Stdout is a shared entity, so every usage of it will be affected by the above example. For applications supporting multiple regions create multiple Locale instances instead, and cache them in an appropriate manner.

In addition to region-specific currency, date and time, Locale adds more sophisticated formatting option than Layout provides: numeric digit placement using '#' formatting, for example, is supported by Locale - along with placement of '$', '-', and '.' regional-specifics.

Locale is currently utf8 only. Support for both Utf16 and utf32 may be enabled at a later time