| TypeInfo type | An object that specifies the type of formatting to retrieve. |
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
| const(char)[] cultureName | The name of the Culture. |
| int cultureID | The identifer (LCID) of the Culture. |
| TypeInfo type | The TypeInfo of the resulting formatting object. |
| int cultureID | The identifier of the culture. |
| const(char)[] cultureName | The name of the culture. |
| const(char)[] name | The name of the language. |
| CultureTypes types | A combination of CultureTypes. |
| Culture value | The Culture instance representing the user's current culture. |
import tango.io.Print, tango.text.locale.Common;
void main() {
// Displays the name of the current culture.
Println("The current culture is %s.", Culture.current.englishName);
// Changes the current culture to el-GR.
Culture.current = new Culture("el-GR");
Println("The current culture is now %s.", Culture.current.englishName);
}
// Produces the following output:
// The current culture is English (United Kingdom).
// The current culture is now Greek (Greece).
import tango.io.Print, tango.text.locale.Common;
void main() {
foreach (c; Culture.getCultures(CultureTypes.All)) {
if (c.twoLetterLanguageName == "zh") {
Print(c.englishName);
if (c.isNeutral)
Println("neutral");
else
Println("specific");
}
}
}
// Produces the following output:
// Chinese (Simplified) - neutral
// Chinese (Taiwan) - specific
// Chinese (People's Republic of China) - specific
// Chinese (Hong Kong S.A.R.) - specific
// Chinese (Singapore) - specific
// Chinese (Macao S.A.R.) - specific
// Chinese (Traditional) - neutral
| values | A NumberFormat defining the culturally appropriate format for displaying numbers and currency. |
| values | A DateTimeFormat defining the culturally appropriate format for displaying dates and times. |
import tango.io.Print, tango.text.locale.Common;
void main() {
Region region = new Region("en-GB");
Println("name: %s", region.name);
Println("englishName: %s", region.englishName);
Println("isMetric: %s", region.isMetric);
Println("currencySymbol: %s", region.currencySymbol);
Println("isoCurrencySymbol: %s", region.isoCurrencySymbol);
}
// Produces the following output.
// name: en-GB
// englishName: United Kingdom
// isMetric: true
// currencySymbol: £
// isoCurrencySymbol: GBP
| int cultureID | A culture indentifier. |
| const(char)[] name | A two-letter ISO 3166 code for the region. Or, a culture name consisting of the language and region. |
import tango.io.Print, tango.text.locale.Common;
void main(char[][] args) {
foreach (c; Culture.getCultures(CultureTypes.Specific)) {
if (c.twoLetterLanguageName == "en") {
NumberFormat fmt = c.numberFormat;
Println("The currency symbol for %s is '%s'",
c.englishName,
fmt.currencySymbol);
}
}
}
// Produces the following output:
// The currency symbol for English (United States) is '$'
// The currency symbol for English (United Kingdom) is '£'
// The currency symbol for English (Australia) is '$'
// The currency symbol for English (Canada) is '$'
// The currency symbol for English (New Zealand) is '$'
// The currency symbol for English (Ireland) is '€'
// The currency symbol for English (South Africa) is 'R'
// The currency symbol for English (Jamaica) is 'J$'
// The currency symbol for English (Caribbean) is '$'
// The currency symbol for English (Belize) is 'BZ$'
// The currency symbol for English (Trinidad and Tobago) is 'TT$'
// The currency symbol for English (Zimbabwe) is 'Z$'
// The currency symbol for English (Republic of the Philippines) is 'Php'
| TypeInfo type | The TypeInfo of the resulting formatting object. |
| IFormatService formatService | The IFormatService used to retrieve NumberFormat. |
| int value | The number of decimal places used for numbers. |
import tango.io.Print, tango.text.locale.Common;
void main() {
// Get the NumberFormat from the en-GB culture.
NumberFormat fmt = (new Culture("en-GB")).numberFormat;
// Display a value with the default number of decimal digits.
int n = 5678;
Println(Formatter.format(fmt, "{0:N}", n));
// Display the value with six decimal digits.
fmt.numberDecimalDigits = 6;
Println(Formatter.format(fmt, "{0:N}", n));
}
// Produces the following output:
// 5,678.00
// 5,678.000000
| Value | Pattern |
|---|---|
| 0 | (n) |
| 1 | -n |
| 2 | - n |
| 3 | n- |
| 4 | n - |
| int value | The format pattern for negative numbers. |
import tango.io.Print, tango.text.locale.Common;
void main() {
NumberFormat fmt = new NumberFormat;
int n = -5678;
// Display the default pattern.
Println(Formatter.format(fmt, "{0:N}", n));
// Display all patterns.
for (int i = 0; i <= 4; i++) {
fmt.numberNegativePattern = i;
Println(Formatter.format(fmt, "{0:N}", n));
}
}
// Produces the following output:
// (5,678.00)
// (5,678.00)
// -5,678.00
// - 5,678.00
// 5,678.00-
// 5,678.00 -
| int value | The number of decimal digits to use in currency values. |
| int value | The format pattern to use for negative currency values. |
| const(int)[] value | The number of digits int each group to the left of the decimal place in numbers. |
| const(int)[] value | The number of digits int each group to the left of the decimal place in currency values. |
| const(char)[] value | The string separating groups of digits to the left of the decimal place in numbers. |
| const(char)[] value | The string used as the decimal separator in numbers. |
| const(char)[] value | The string separating groups of digits to the left of the decimal place in currency values. |
| const(char)[] value | The string used as the decimal separator in currency values. |
| const(char)[] value | The string used as the currency symbol. |
| const(char)[] value | The string denoting that a number is negative. |
| const(char)[] value | The string denoting that a number is positive. |
| const(char)[] value | The string representing the NaN value. |
| const(char)[] value | The string representing negative infinity. |
| const(char)[] value | The string representing positive infinity. |
| const(char[])[] value | A string array of native equivalents of the digits 0 to 9. |
| TypeInfo type | The TypeInfo of the resulting formatting object. |
| Calendar.DayOfWeek dayOfWeek | A DayOfWeek value. |
| Calendar.DayOfWeek dayOfWeek | A DayOfWeek value. |
| int month | An integer between 1 and 13 indicating the name of the month to return. |
| int month | An integer between 1 and 13 indicating the name of the month to return. |
| IFormatService formatService | The IFormatService used to retrieve DateTimeFormat. |
| Calendar value | The Calendar determining the calendar to be used by the current culture. |
| valie | A DayOfWeek value indicating the first day of the week. |
| Calendar.WeekRule value | A CalendarWeekRule value determining the first week of the year. |
| const(char)[] value | The string separating date components. |
| const(char)[] value | The string separating time components. |
| const(char)[] value | The string designator for hours before noon. |
| const(char)[] value | The string designator for hours after noon. |
| const(char)[] value | The format pattern for a short date value. |
| const(char)[] value | The format pattern for a short time value. |
| const(char)[] value | The format pattern for a long date value. |
| const(char)[] value | The format pattern for a long time value. |
| const(char)[] value | The format pattern for a month and day value. |
| const(char)[] value | The format pattern for a year and month value. |
| const(char)[][] value | A string array containing the abbreviated names of the days of the week. |
| const(char)[][] value | A string array containing the full names of the days of the week. |
| const(char)[][] value | A string array containing the abbreviated names of the months. |
| const(char)[][] value | A string array containing the full names of the months. |
| const(char)[] value | The format pattern for a long date and a long time value. |