1 <section xmlns="http://docbook.org/ns/docbook" version="5.0"
2 xml:id="std.localization.locales.locale" xreflabel="Locale">
4 <info><title>locale</title>
18 Describes the basic locale object, including nested
19 classes id, facet, and the reference-counted implementation object,
23 <section xml:id="locales.locale.req"><info><title>Requirements</title></info>
27 Class locale is non-templatized and has two distinct types nested
35 22.1.1.1.2 Class locale::facet
41 Facets actually implement locale functionality. For instance, a facet
42 called numpunct is the data object that can be used to query for the
43 thousands separator in the locale.
47 Literally, a facet is strictly defined:
53 Containing the following public data member:
56 <code>static locale::id id;</code>
62 Derived from another facet:
65 <code>class gnu_codecvt: public std::ctype<user-defined-type></code>
71 Of interest in this class are the memory management options explicitly
72 specified as an argument to facet's constructor. Each constructor of a
73 facet class takes a std::size_t __refs argument: if __refs == 0, the
74 facet is deleted when the locale containing it is destroyed. If __refs
75 == 1, the facet is not destroyed, even when it is no longer
83 22.1.1.1.3 - Class locale::id
89 Provides an index for looking up specific facets.
93 <section xml:id="locales.locale.design"><info><title>Design</title></info>
97 The major design challenge is fitting an object-orientated and
98 non-global locale design on top of POSIX and other relevant standards,
99 which include the Single Unix (nee X/Open.)
103 Because C and earlier versions of POSIX fall down so completely,
104 portability is an issue.
109 <section xml:id="locales.locale.impl"><info><title>Implementation</title></info>
112 <section xml:id="locale.impl.c"><info><title>Interacting with "C" locales</title></info>
118 <code>`locale -a`</code> displays available locales.
426 <code>`locale`</code> displays environmental variables that
427 impact how locale("") will be deduced.
442 LC_MEASUREMENT="en_US"
443 LC_IDENTIFICATION="en_US"
451 From Josuttis, p. 697-698, which says, that "there is only *one*
452 relation (of the C++ locale mechanism) to the C locale mechanism: the
453 global C locale is modified if a named C++ locale object is set as the
454 global locale" (emphasis Paolo), that is:
457 <programlisting>std::locale::global(std::locale(""));</programlisting>
459 <para>affects the C functions as if the following call was made:</para>
461 <programlisting>std::setlocale(LC_ALL, "");</programlisting>
464 On the other hand, there is *no* vice versa, that is, calling
465 setlocale has *no* whatsoever on the C++ locale mechanism, in
466 particular on the working of locale(""), which constructs the locale
467 object from the environment of the running program, that is, in
468 practice, the set of LC_ALL, LANG, etc. variable of the shell.
474 <section xml:id="locales.locale.future"><info><title>Future</title></info>
480 Locale initialization: at what point does _S_classic, _S_global
481 get initialized? Can named locales assume this initialization
482 has already taken place?
488 Document how named locales error check when filling data
489 members. I.e., a fr_FR locale that doesn't have
490 numpunct::truename(): does it use "true"? Or is it a blank
491 string? What's the convention?
497 Explain how locale aliasing happens. When does "de_DE" use "de"
498 information? What is the rule for locales composed of just an
499 ISO language code (say, "de") and locales with both an ISO
500 language code and ISO country code (say, "de_DE").
506 What should non-required facet instantiations do? If the
507 generic implementation is provided, then how to end-users
508 provide specializations?
514 <bibliography xml:id="locales.locale.biblio"><info><title>Bibliography</title></info>
521 <author><personname><surname>McGrath</surname><firstname>Roland</firstname></personname></author>
522 <author><personname><surname>Drepper</surname><firstname>Ulrich</firstname></personname></author>
528 Chapters 6 Character Set Handling and 7 Locales and
537 <author><personname><surname>Drepper</surname><firstname>Ulrich</firstname></personname></author>
546 ISO/IEC 14882:1998 Programming languages - C++
556 ISO/IEC 9899:1999 Programming languages - C
566 <link xmlns:xlink="http://www.w3.org/1999/xlink"
567 xlink:href="http://www.opengroup.org/austin/">
568 System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)
574 The Open Group/The Institute of Electrical and Electronics
582 The C++ Programming Language, Special Edition
584 <author><personname><surname>Stroustrup</surname><firstname>Bjarne</firstname></personname></author>
587 <holder>Addison Wesley, Inc.</holder>
589 <pagenums>Appendix D</pagenums>
599 Standard C++ IOStreams and Locales
602 Advanced Programmer's Guide and Reference
604 <author><personname><surname>Langer</surname><firstname>Angelika</firstname></personname></author>
605 <author><personname><surname>Kreft</surname><firstname>Klaus</firstname></personname></author>
608 <holder>Addison Wesley Longman, Inc.</holder>
612 Addison Wesley Longman