<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>Chapter8. Localization</title><metaname="generator"content="DocBook XSL Stylesheets Vsnapshot"/><metaname="keywords"content="ISO C++, library"/><metaname="keywords"content="ISO C++, runtime, library"/><linkrel="home"href="../index.html"title="The GNU C++ Library"/><linkrel="up"href="std_contents.html"title="PartII. Standard Contents"/><linkrel="prev"href="strings.html"title="Chapter7. Strings"/><linkrel="next"href="facets.html"title="Facets"/></head><body><divclass="navheader"><tablewidth="100%"summary="Navigation header"><tr><thcolspan="3"align="center">Chapter8.
</h2></div></div></div><divclass="toc"><p><strong>Table of Contents</strong></p><dlclass="toc"><dt><spanclass="section"><ahref="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><spanclass="section"><ahref="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><spanclass="section"><ahref="localization.html#locales.locale.req">Requirements</a></span></dt><dt><spanclass="section"><ahref="localization.html#locales.locale.design">Design</a></span></dt><dt><spanclass="section"><ahref="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><spanclass="section"><ahref="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><spanclass="section"><ahref="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><spanclass="section"><ahref="facets.html">Facets</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#facet.ctype.impl.spec">Specializations</a></span></dt></dl></dd><dt><spanclass="section"><ahref="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><spanclass="section"><ahref="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><spanclass="section"><ahref="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#codecvt.design.wchar_t_size"><spanclass="type">wchar_t</span> Size</a></span></dt><dt><spanclass="section"><ahref="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><spanclass="section"><ahref="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><spanclass="section"><ahref="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><spanclass="section"><ahref="facets.html#facet.codecvt.use">Use</a></span></dt><dt><spanclass="section"><ahref="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><spanclass="section"><ahref="facets.html#std.localization.facet.messages">messages</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#facet.messages.req">Requirements</a></span></dt><dt><spanclass="section"><ahref="facets.html#facet.messages.design">Design</a></span></dt><dt><spanclass="section"><ahref="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><spanclass="section"><ahref="facets.html#messages.impl.models">Models</a></span></dt><dt><spanclass="section"><ahref="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><spanclass="section"><ahref="facets.html#facet.messages.use">Use</a></span></dt><dt><spanclass="section"><ahref="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="std.localization.locales"></a>Locales</h2></div></div></div><divclass="section"><divclass="titlepage"><div><div><h3class="title"><aid="std.localization.locales.locale"></a>locale</h3></div></div></div><p>
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:
</p><preclass="programlisting">std::locale::global(std::locale(""));</pre><p>affects the C functions as if the following call was made:</p><preclass="programlisting">std::setlocale(LC_ALL, "");</pre><p>
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.