Chapter 8.  Localization

Table of Contents

Locales
locale
Facets
ctype
codecvt
messages

Describes the basic locale object, including nested classes id, facet, and the reference-counted implementation object, class _Impl.

From Josuttis, p. 697-698, which says, that "there is only *one* relation (of the C++ locale mechanism) to the C locale mechanism: the global C locale is modified if a named C++ locale object is set as the global locale" (emphasis Paolo), that is:

std::locale::global(std::locale(""));

affects the C functions as if the following call was made:

std::setlocale(LC_ALL, "");

On the other hand, there is *no* vice versa, that is, calling setlocale has *no* whatsoever on the C++ locale mechanism, in particular on the working of locale(""), which constructs the locale object from the environment of the running program, that is, in practice, the set of LC_ALL, LANG, etc. variable of the shell.