OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [doc/] [html/] [manual/] [localization.html] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapter 8.  Localization</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    "/><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      runtime&#10;    , &#10;      library&#10;    "/><link rel="home" href="../index.html" title="The GNU C++ Library"/><link rel="up" href="bk01pt02.html" title="Part II.  Standard Contents"/><link rel="prev" href="strings.html" title="Chapter 7.  Strings"/><link rel="next" href="facets.html" title="Facets"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. 
4
  Localization
5
 
6
</th></tr><tr><td align="left"><a accesskey="p" href="strings.html">Prev</a> </td><th width="60%" align="center">Part II. 
7
    Standard Contents
8
  </th><td align="right"> <a accesskey="n" href="facets.html">Next</a></td></tr></table><hr/></div><div class="chapter" title="Chapter 8.  Localization"><div class="titlepage"><div><div><h2 class="title"><a id="std.localization"/>Chapter 8. 
9
  Localization
10
  <a id="id500383" class="indexterm"/>
11
</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#id501036">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></div><div class="section" title="Locales"><div class="titlepage"><div><div><h2 class="title"><a id="std.localization.locales"/>Locales</h2></div></div></div><div class="section" title="locale"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.locales.locale"/>locale</h3></div></div></div><p>
12
Describes the basic locale object, including nested
13
classes id, facet, and the reference-counted implementation object,
14
class _Impl.
15
</p><div class="section" title="Requirements"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.req"/>Requirements</h4></div></div></div><p>
16
Class locale is non-templatized and has two distinct types nested
17
inside of it:
18
</p><div class="blockquote"><blockquote class="blockquote"><p>
19
<span class="emphasis"><em>
20
class facet
21
22.1.1.1.2 Class locale::facet
22
</em></span>
23
</p></blockquote></div><p>
24
Facets actually implement locale functionality. For instance, a facet
25
called numpunct is the data object that can be used to query for the
26
thousands separator in the locale.
27
</p><p>
28
Literally, a facet is strictly defined:
29
</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>
30
      Containing the following public data member:
31
    </p><p>
32
      <code class="code">static locale::id id;</code>
33
    </p></li><li class="listitem"><p>
34
      Derived from another facet:
35
    </p><p>
36
      <code class="code">class gnu_codecvt: public std::ctype&lt;user-defined-type&gt;</code>
37
    </p></li></ul></div><p>
38
Of interest in this class are the memory management options explicitly
39
specified as an argument to facet's constructor. Each constructor of a
40
facet class takes a std::size_t __refs argument: if __refs == 0, the
41
facet is deleted when the locale containing it is destroyed. If __refs
42
== 1, the facet is not destroyed, even when it is no longer
43
referenced.
44
</p><div class="blockquote"><blockquote class="blockquote"><p>
45
<span class="emphasis"><em>
46
class id
47
22.1.1.1.3 - Class locale::id
48
</em></span>
49
</p></blockquote></div><p>
50
Provides an index for looking up specific facets.
51
</p></div><div class="section" title="Design"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.design"/>Design</h4></div></div></div><p>
52
The major design challenge is fitting an object-orientated and
53
non-global locale design on top of POSIX and other relevant standards,
54
which include the Single Unix (nee X/Open.)
55
</p><p>
56
Because C and earlier versions of POSIX fall down so completely,
57
portability is an issue.
58
</p></div><div class="section" title="Implementation"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.impl"/>Implementation</h4></div></div></div><div class="section" title="Interacting with &quot;C&quot; locales"><div class="titlepage"><div><div><h5 class="title"><a id="locale.impl.c"/>Interacting with "C" locales</h5></div></div></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>
59
       <code class="code">`locale -a`</code> displays available locales.
60
     </p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting">
61
af_ZA
62
ar_AE
63
ar_AE.utf8
64
ar_BH
65
ar_BH.utf8
66
ar_DZ
67
ar_DZ.utf8
68
ar_EG
69
ar_EG.utf8
70
ar_IN
71
ar_IQ
72
ar_IQ.utf8
73
ar_JO
74
ar_JO.utf8
75
ar_KW
76
ar_KW.utf8
77
ar_LB
78
ar_LB.utf8
79
ar_LY
80
ar_LY.utf8
81
ar_MA
82
ar_MA.utf8
83
ar_OM
84
ar_OM.utf8
85
ar_QA
86
ar_QA.utf8
87
ar_SA
88
ar_SA.utf8
89
ar_SD
90
ar_SD.utf8
91
ar_SY
92
ar_SY.utf8
93
ar_TN
94
ar_TN.utf8
95
ar_YE
96
ar_YE.utf8
97
be_BY
98
be_BY.utf8
99
bg_BG
100
bg_BG.utf8
101
br_FR
102
bs_BA
103
C
104
ca_ES
105
ca_ES@euro
106
ca_ES.utf8
107
ca_ES.utf8@euro
108
cs_CZ
109
cs_CZ.utf8
110
cy_GB
111
da_DK
112
da_DK.iso885915
113
da_DK.utf8
114
de_AT
115
de_AT@euro
116
de_AT.utf8
117
de_AT.utf8@euro
118
de_BE
119
de_BE@euro
120
de_BE.utf8
121
de_BE.utf8@euro
122
de_CH
123
de_CH.utf8
124
de_DE
125
de_DE@euro
126
de_DE.utf8
127
de_DE.utf8@euro
128
de_LU
129
de_LU@euro
130
de_LU.utf8
131
de_LU.utf8@euro
132
el_GR
133
el_GR.utf8
134
en_AU
135
en_AU.utf8
136
en_BW
137
en_BW.utf8
138
en_CA
139
en_CA.utf8
140
en_DK
141
en_DK.utf8
142
en_GB
143
en_GB.iso885915
144
en_GB.utf8
145
en_HK
146
en_HK.utf8
147
en_IE
148
en_IE@euro
149
en_IE.utf8
150
en_IE.utf8@euro
151
en_IN
152
en_NZ
153
en_NZ.utf8
154
en_PH
155
en_PH.utf8
156
en_SG
157
en_SG.utf8
158
en_US
159
en_US.iso885915
160
en_US.utf8
161
en_ZA
162
en_ZA.utf8
163
en_ZW
164
en_ZW.utf8
165
es_AR
166
es_AR.utf8
167
es_BO
168
es_BO.utf8
169
es_CL
170
es_CL.utf8
171
es_CO
172
es_CO.utf8
173
es_CR
174
es_CR.utf8
175
es_DO
176
es_DO.utf8
177
es_EC
178
es_EC.utf8
179
es_ES
180
es_ES@euro
181
es_ES.utf8
182
es_ES.utf8@euro
183
es_GT
184
es_GT.utf8
185
es_HN
186
es_HN.utf8
187
es_MX
188
es_MX.utf8
189
es_NI
190
es_NI.utf8
191
es_PA
192
es_PA.utf8
193
es_PE
194
es_PE.utf8
195
es_PR
196
es_PR.utf8
197
es_PY
198
es_PY.utf8
199
es_SV
200
es_SV.utf8
201
es_US
202
es_US.utf8
203
es_UY
204
es_UY.utf8
205
es_VE
206
es_VE.utf8
207
et_EE
208
et_EE.utf8
209
eu_ES
210
eu_ES@euro
211
eu_ES.utf8
212
eu_ES.utf8@euro
213
fa_IR
214
fi_FI
215
fi_FI@euro
216
fi_FI.utf8
217
fi_FI.utf8@euro
218
fo_FO
219
fo_FO.utf8
220
fr_BE
221
fr_BE@euro
222
fr_BE.utf8
223
fr_BE.utf8@euro
224
fr_CA
225
fr_CA.utf8
226
fr_CH
227
fr_CH.utf8
228
fr_FR
229
fr_FR@euro
230
fr_FR.utf8
231
fr_FR.utf8@euro
232
fr_LU
233
fr_LU@euro
234
fr_LU.utf8
235
fr_LU.utf8@euro
236
ga_IE
237
ga_IE@euro
238
ga_IE.utf8
239
ga_IE.utf8@euro
240
gl_ES
241
gl_ES@euro
242
gl_ES.utf8
243
gl_ES.utf8@euro
244
gv_GB
245
gv_GB.utf8
246
he_IL
247
he_IL.utf8
248
hi_IN
249
hr_HR
250
hr_HR.utf8
251
hu_HU
252
hu_HU.utf8
253
id_ID
254
id_ID.utf8
255
is_IS
256
is_IS.utf8
257
it_CH
258
it_CH.utf8
259
it_IT
260
it_IT@euro
261
it_IT.utf8
262
it_IT.utf8@euro
263
iw_IL
264
iw_IL.utf8
265
ja_JP.eucjp
266
ja_JP.utf8
267
ka_GE
268
kl_GL
269
kl_GL.utf8
270
ko_KR.euckr
271
ko_KR.utf8
272
kw_GB
273
kw_GB.utf8
274
lt_LT
275
lt_LT.utf8
276
lv_LV
277
lv_LV.utf8
278
mi_NZ
279
mk_MK
280
mk_MK.utf8
281
mr_IN
282
ms_MY
283
ms_MY.utf8
284
mt_MT
285
mt_MT.utf8
286
nl_BE
287
nl_BE@euro
288
nl_BE.utf8
289
nl_BE.utf8@euro
290
nl_NL
291
nl_NL@euro
292
nl_NL.utf8
293
nl_NL.utf8@euro
294
nn_NO
295
nn_NO.utf8
296
no_NO
297
no_NO.utf8
298
oc_FR
299
pl_PL
300
pl_PL.utf8
301
POSIX
302
pt_BR
303
pt_BR.utf8
304
pt_PT
305
pt_PT@euro
306
pt_PT.utf8
307
pt_PT.utf8@euro
308
ro_RO
309
ro_RO.utf8
310
ru_RU
311
ru_RU.koi8r
312
ru_RU.utf8
313
ru_UA
314
ru_UA.utf8
315
se_NO
316
sk_SK
317
sk_SK.utf8
318
sl_SI
319
sl_SI.utf8
320
sq_AL
321
sq_AL.utf8
322
sr_YU
323
sr_YU@cyrillic
324
sr_YU.utf8
325
sr_YU.utf8@cyrillic
326
sv_FI
327
sv_FI@euro
328
sv_FI.utf8
329
sv_FI.utf8@euro
330
sv_SE
331
sv_SE.iso885915
332
sv_SE.utf8
333
ta_IN
334
te_IN
335
tg_TJ
336
th_TH
337
th_TH.utf8
338
tl_PH
339
tr_TR
340
tr_TR.utf8
341
uk_UA
342
uk_UA.utf8
343
ur_PK
344
uz_UZ
345
vi_VN
346
vi_VN.tcvn
347
wa_BE
348
wa_BE@euro
349
yi_US
350
zh_CN
351
zh_CN.gb18030
352
zh_CN.gbk
353
zh_CN.utf8
354
zh_HK
355
zh_HK.utf8
356
zh_TW
357
zh_TW.euctw
358
zh_TW.utf8
359
</pre></blockquote></div></li><li class="listitem"><p>
360
       <code class="code">`locale`</code> displays environmental variables that
361
       impact how locale("") will be deduced.
362
     </p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting">
363
LANG=en_US
364
LC_CTYPE="en_US"
365
LC_NUMERIC="en_US"
366
LC_TIME="en_US"
367
LC_COLLATE="en_US"
368
LC_MONETARY="en_US"
369
LC_MESSAGES="en_US"
370
LC_PAPER="en_US"
371
LC_NAME="en_US"
372
LC_ADDRESS="en_US"
373
LC_TELEPHONE="en_US"
374
LC_MEASUREMENT="en_US"
375
LC_IDENTIFICATION="en_US"
376
LC_ALL=
377
</pre></blockquote></div></li></ul></div><p>
378
From Josuttis, p. 697-698, which says, that "there is only *one*
379
relation (of the C++ locale mechanism) to the C locale mechanism: the
380
global C locale is modified if a named C++ locale object is set as the
381
global locale" (emphasis Paolo), that is:
382
</p><pre class="programlisting">std::locale::global(std::locale(""));</pre><p>affects the C functions as if the following call was made:</p><pre class="programlisting">std::setlocale(LC_ALL, "");</pre><p>
383
  On the other hand, there is *no* vice versa, that is, calling
384
  setlocale has *no* whatsoever on the C++ locale mechanism, in
385
  particular on the working of locale(""), which constructs the locale
386
  object from the environment of the running program, that is, in
387
  practice, the set of LC_ALL, LANG, etc. variable of the shell.
388
</p></div></div><div class="section" title="Future"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.future"/>Future</h4></div></div></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>
389
       Locale initialization: at what point does _S_classic, _S_global
390
       get initialized? Can named locales assume this initialization
391
       has already taken place?
392
     </p></li><li class="listitem"><p>
393
       Document how named locales error check when filling data
394
       members. I.e., a fr_FR locale that doesn't have
395
       numpunct::truename(): does it use "true"? Or is it a blank
396
       string? What's the convention?
397
   </p></li><li class="listitem"><p>
398
       Explain how locale aliasing happens. When does "de_DE" use "de"
399
       information? What is the rule for locales composed of just an
400
       ISO language code (say, "de") and locales with both an ISO
401
       language code and ISO country code (say, "de_DE").
402
     </p></li><li class="listitem"><p>
403
       What should non-required facet instantiations do?  If the
404
       generic implementation is provided, then how to end-users
405
       provide specializations?
406
   </p></li></ul></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.biblio"/>Bibliography</h4></div></div></div><div class="biblioentry"><a id="id500746"/><p><span class="citetitle"><em class="citetitle">
407
      The GNU C Library
408
    </em>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">
409
      Chapters 6 Character Set Handling and 7 Locales and
410
      Internationalization
411
    . </span></p></div><div class="biblioentry"><a id="id500786"/><p><span class="citetitle"><em class="citetitle">
412
      Correspondence
413
    </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id500811"/><p><span class="citetitle"><em class="citetitle">
414
      ISO/IEC 14882:1998 Programming languages - C++
415
    </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id500830"/><p><span class="citetitle"><em class="citetitle">
416
      ISO/IEC 9899:1999 Programming languages - C
417
    </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry" title="System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)"><a id="id500849"/><p><span class="title"><em>
418
        <a class="link" href="http://www.opengroup.org/austin/">
419
      System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008)
420
        </a>
421
      </em>. </span><span class="copyright">Copyright © 2008
422
        The Open Group/The Institute of Electrical and Electronics
423
        Engineers, Inc.
424
      . </span></p></div><div class="biblioentry"><a id="id500876"/><p><span class="citetitle"><em class="citetitle">
425
      The C++ Programming Language, Special Edition
426
    </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
427
        Addison Wesley
428
      . </span></span></p></div><div class="biblioentry"><a id="id500915"/><p><span class="citetitle"><em class="citetitle">
429
      Standard C++ IOStreams and Locales
430
    </em>. </span><span class="subtitle">
431
      Advanced Programmer's Guide and Reference
432
    . </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername">
433
        Addison Wesley Longman
434
      . </span></span></p></div></div></div></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="strings.html">Prev</a> </td><td align="center"><a accesskey="u" href="bk01pt02.html">Up</a></td><td align="right"> <a accesskey="n" href="facets.html">Next</a></td></tr><tr><td align="left" valign="top">Chapter 7. 
435
  Strings
436
 
437
 </td><td align="center"><a accesskey="h" href="../index.html">Home</a></td><td align="right" valign="top"> Facets</td></tr></table></div></body></html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.