Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Table of Contents

  1. Culture
  2. Convert
  3. Collation
  4. Locale
  5. Parse



Docs: 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. Examples:

import, tango.text.locale.Core;

void main() {
  Culture culture = new Culture("it-IT");

  Stdout.formatln("englishName: {}", culture.englishName);
  Stdout.formatln("nativeName: {}", culture.nativeName);
  Stdout.formatln("name: {}",;
  Stdout.formatln("parent: {}",;
  Stdout.formatln("isNeutral: {}", culture.isNeutral);

Produces the following output:

englishName: Italian (Italy)
nativeName: italiano (Italia)
name: it-IT
parent: it
isNeutral: false

The users Culture can be obtained by using the zero argument constructor:

  Culture culture = new Culture(); // users culture

Note: On linux this first looks at the environment variable "LC_ALL" then at "LANG".


Docs: Convert

Convert date and time to culture specific output.


Docs: Collation

String comparison


Docs: Locale

A Layout which does number formating in a culture sensitive way.


Docs: Parse

Parse dates and time with given culture.