1 <sect1 id=
"manual.localization.locales.locale" xreflabel=
"Locale">
17 Describes the basic locale object, including nested
18 classes id, facet, and the reference-counted implementation object,
22 <sect2 id=
"locales.locale.req">
23 <title>Requirements
</title>
26 Class locale is non-templatized and has two distinct types nested
34 22.1.1.1.2 Class locale::facet
40 Facets actually implement locale functionality. For instance, a facet
41 called numpunct is the data objects that can be used to query for the
42 thousands separator is in the German locale.
46 Literally, a facet is strictly defined:
52 Containing the following public data member:
55 <code>static locale::id id;
</code>
61 Derived from another facet:
64 <code>class gnu_codecvt: public std::ctype
<user-defined-type
></code>
70 Of interest in this class are the memory management options explicitly
71 specified as an argument to facet's constructor. Each constructor of a
72 facet class takes a std::size_t __refs argument: if __refs ==
0, the
73 facet is deleted when the locale containing it is destroyed. If __refs
74 ==
1, the facet is not destroyed, even when it is no longer
82 22.1.1.1.3 - Class locale::id
88 Provides an index for looking up specific facets.
92 <sect2 id=
"locales.locale.design">
96 The major design challenge is fitting an object-orientated and
97 non-global locale design on top of POSIX and other relevant standards,
98 which include the Single Unix (nee X/Open.)
102 Because C and earlier versions of POSIX fall down so completely,
103 portability is an issue.
108 <sect2 id=
"locales.locale.impl">
109 <title>Implementation
</title>
111 <sect3 id=
"locale.impl.c">
112 <title>Interacting with
"C
" locales
</title>
117 <code>`locale -a`
</code> displays available locales.
425 <code>`locale`
</code> displays environmental variables that
426 impact how locale(
"") will be deduced.
441 LC_MEASUREMENT=
"en_US"
442 LC_IDENTIFICATION=
"en_US"
450 From Josuttis, p.
697-
698, which says, that
"there is only *one*
451 relation (of the C++ locale mechanism) to the C locale mechanism: the
452 global C locale is modified if a named C++ locale object is set as the
453 global locale" (emphasis Paolo), that is:
456 <programlisting>std::locale::global(std::locale(
""));
</programlisting>
458 <para>affects the C functions as if the following call was made:
</para>
460 <programlisting>std::setlocale(LC_ALL,
"");
</programlisting>
463 On the other hand, there is *no* vice versa, that is, calling
464 setlocale has *no* whatsoever on the C++ locale mechanism, in
465 particular on the working of locale(
""), which constructs the locale
466 object from the environment of the running program, that is, in
467 practice, the set of LC_ALL, LANG, etc. variable of the shell.
473 <sect2 id=
"locales.locale.future">
474 <title>Future
</title>
479 Locale initialization: at what point does _S_classic, _S_global
480 get initialized? Can named locales assume this initialization
481 has already taken place?
487 Document how named locales error check when filling data
488 members. I.e., a fr_FR locale that doesn't have
489 numpunct::truename(): does it use
"true"? Or is it a blank
490 string? What's the convention?
496 Explain how locale aliasing happens. When does
"de_DE" use
"de"
497 information? What is the rule for locales composed of just an
498 ISO language code (say,
"de") and locales with both an ISO
499 language code and ISO country code (say,
"de_DE").
505 What should non-required facet instantiations do? If the
506 generic implementation is provided, then how to end-users
507 provide specializations?
513 <bibliography id=
"locales.locale.biblio">
514 <title>Bibliography
</title>
522 <surname>McGrath
</surname>
523 <firstname>Roland
</firstname>
526 <surname>Drepper
</surname>
527 <firstname>Ulrich
</firstname>
534 <pagenums>Chapters
6 Character Set Handling and
7 Locales and Internationalization
</pagenums>
544 <surname>Drepper
</surname>
545 <firstname>Ulrich
</firstname>
556 ISO/IEC
14882:
1998 Programming languages - C++
567 ISO/IEC
9899:
1999 Programming languages - C
578 System Interface Definitions, Issue
6 (IEEE Std.
1003.1-
200x)
584 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.
</holder>
588 <ulink url=
"http://www.opennc.org/austin/docreg.html">
596 The C++ Programming Language, Special Edition
600 <surname>Stroustrup
</surname>
601 <firstname>Bjarne
</firstname>
606 <holder>Addison Wesley, Inc.
</holder>
608 <pagenums>Appendix D
</pagenums>
621 Standard C++ IOStreams and Locales
624 Advanced Programmer's Guide and Reference
628 <surname>Langer
</surname>
629 <firstname>Angelika
</firstname>
633 <surname>Kreft
</surname>
634 <firstname>Klaus
</firstname>
639 <holder>Addison Wesley Longman, Inc.
</holder>
644 Addison Wesley Longman