Skip to content

Localization (locale.h)

Include locale.h for locale categories and fixed-C-locale formatting conventions.

Types and Macros

Name Meaning
LC_ALL All locale categories.
LC_COLLATE String collation.
LC_CTYPE Character classification and conversion.
LC_MONETARY Monetary formatting.
LC_NUMERIC Numeric formatting (decimal point etc.).
LC_TIME Date and time formatting.
struct lconv Numeric and monetary formatting conventions.

struct lconv has the standard C89 numeric and monetary formatting members. In DCC's fixed C locale, decimal_point is ".", every other string is empty, and every char field is CHAR_MAX (not applicable).

Functions

Function Summary
struct lconv *localeconv(void) Return a pointer to the current locale's formatting conventions.
char *setlocale(int category, const char *locale) Set or query the program locale. Only "C" and "" (implementation default, also "C") are supported. Returns "C" on success, NULL if the requested locale is unavailable.

Fixed locale model

The active locale is always "C". setlocale(category, NULL) queries it, and requesting either "C" or the implementation default "" succeeds and returns "C". Any other locale name returns NULL. Because every category is fixed, category does not change the result.

localeconv() returns the same static struct lconv object on every call.