What language are you talking about? C?
In linux (and most unices) there is no concept of a “default locale” AFAIK (besides the “C” or “POSIX” locale). For any given process, there is a “current locale” (the one it should currently use).
The accessing of the current locale is the same in ANSI C regardless of operating system: you use the functions described in §7.11 of the ISO 9899 document. In particular, you may set the locale using setlocale(). You may chose to use any of several categories of activation for the locale (including LC_TIME, LC_NUMERIC, LC_MONETARY, LC_CTYPE, LC_COLLATE, and LC_ALL plus any implementation-specific macros). If you want to obtain the name of the current setting of one of these categories, you pass NULL as the second argument of setlocale(). If you want to get the details of the current locale for application use, you use localeconv().
On POSIX systems (including linux) there is usually at least one more category (LC_MESSAGES) for message catalogs. You might use environment variables to run a program under a specific locale. Additionally, the return values of setlocale() or localeconv() should be copied before use, because they may be clobbered upon subsequent calls to those functions.
|