Skip to content

Locale attributes

Include: Use System\Locale.pkg

See Also: Set_Locale, Get_Locale, Push_Locale, Pop_Locale, Date and time format patterns

Purpose

Locale attributes list the DF_LOCALE_* attributes that can be read with Get_Attribute and customized with Set_Attribute.

Behavior

Locale attributes affect conversions between strings and dates, times, numbers, and currency values.

String-valued locale attributes must be non-empty when set. DF_LOCALE_CURRENCY_UNIT_COUNT and DF_LOCALE_UTC_OFFSET are integer-valued. DF_LOCALE_INDIAN_NUMERALS is Boolean-valued.

Keep the public API spelling when using DF_LOCALE_DECIMAL_SPERATOR, DF_LOCALE_THOUSAND_SEPERATOR, and the backward-compatible alias DF_THOUSANDS_SEPARATOR.

Attributes

Attribute Value type Controls
DF_LOCALE String Active locale selection; can be set to a locale constant or native locale identifier.
DF_LOCALE_LONG_MONTH1 through DF_LOCALE_LONG_MONTH12 String Long month names.
DF_LOCALE_SHORT_MONTH1 through DF_LOCALE_SHORT_MONTH12 String Short month names.
DF_LOCALE_LONG_DAY1 through DF_LOCALE_LONG_DAY7 String Long day names.
DF_LOCALE_SHORT_DAY1 through DF_LOCALE_SHORT_DAY7 String Short day names.
DF_LOCALE_DATE_FORMAT String Date-to-string and string-to-date format.
DF_LOCALE_TIME_FORMAT String Time-to-string and string-to-time format.
DF_LOCALE_DATETIME_FORMAT String DateTime-to-string and string-to-DateTime format.
DF_LOCALE_TIMESPAN_FORMAT String TimeSpan format.
DF_LOCALE_AM_STRING and DF_LOCALE_PM_STRING String AM/PM text for t and tt date-time format tokens.
DF_LOCALE_DECIMAL_SPERATOR String Decimal separator for numeric conversion.
DF_LOCALE_THOUSAND_SEPERATOR String Thousands separator for numeric conversion.
DF_LOCALE_NEGATIVE_SYMBOL String Negative sign text.
DF_LOCALE_CURRENCY_FORMAT String Currency pattern. u writes units, s writes a subunit digit, c writes the currency symbol, and any other character is literal text.
DF_LOCALE_CURRENCY_SYMBOL String Currency symbol.
DF_LOCALE_CURRENCY_UNIT_COUNT Integer Number of subunits per currency unit.
DF_LOCALE_COLLATION String Locale collation setting.
DF_LOCALE_UTC_OFFSET Integer UTC offset in hours for date/time formatting.
DF_LOCALE_LANGUAGE_NAME, DF_LOCALE_COUNTRY_NAME, and DF_LOCALE_SCRIPT_NAME String Locale identifier parts returned by Get_Locale.
DF_LOCALE_INDIAN_NUMERALS Boolean Indian-numbering thousands grouping.
DF_DATE_FORMAT Alias Backward-compatible alias for DF_LOCALE_DATE_FORMAT.
DF_DECIMAL_SEPARATOR Alias Backward-compatible alias for DF_LOCALE_DECIMAL_SPERATOR.
DF_THOUSANDS_SEPARATOR Alias Backward-compatible alias for DF_LOCALE_THOUSAND_SEPERATOR.
DF_LOCALE_CODE Alias Backward-compatible alias for DF_LOCALE_COLLATION.

Examples

Customize month text:

Use System\Locale.pkg

Date dDate
String sDate

Push_Locale
Set_Attribute DF_LOCALE_DATE_FORMAT to "dd MMMM yyyy"
Set_Attribute DF_LOCALE_LONG_MONTH1 to "New World"
Move (DateSet(2024, 1, 1)) to dDate
Move dDate to sDate
Pop_Locale

Customize numeric separators:

Use System\Locale.pkg

String sValue
Number fValue

Push_Locale
Set_Attribute DF_LOCALE_DECIMAL_SPERATOR to ","
Set_Attribute DF_LOCALE_THOUSAND_SEPERATOR to "."
Move "1.234,5" to sValue
Move sValue to fValue
Pop_Locale