Previous Page
Next Page

16.12. Internationalization

The standard library supports the development of C programs that are able to adapt to local cultural conventions. For example, programs may use locale-specific character sets or formats for currency information.

All programs start in the default locale, named "C", which contains no country or language-specific information. During runtime, programs can change their locale or query information about the current locale. The information that makes up a locale is divided into categories, which you can query and set individually.

The functions that operate on the current locale are declared, along with the related types and macros, in the header locale.h. They are listed in Table 16-26.

Table 16-26. Locale functions

Purpose

Function

Query or set the locale for a specified category of information

setlocale( )

Get information about the local formatting conventions for numeric and monetary strings

localeconv( )


Many functions make use of locale-specific information. The standard library function descriptions in Chapter 17 point out whenever a given function accesses locale settings. Such functions include the following:

  • Character classification and case mapping functions

  • Locale-sensitive string comparison (strcoll( ) and wcscoll( ))

  • Date and time formatting (strftime( ) and wcsftime( ))

  • Conversion of numeral strings

  • Conversions between multibyte and wide characters


Previous Page
Next Page