Locale
Culture
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.io.Stdout, 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: {}", culture.name); Stdout.formatln("parent: {}", culture.parent.name); 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".
Convert
Docs: Convert
Convert date and time to culture specific output.
Collation
Docs: Collation
String comparison
Locale
Docs: Locale
A Layout which does number formating in a culture sensitive way.
Parse
Docs: Parse
Parse dates and time with given culture.