Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c01f6e6

Browse files
committed
Use a table to describe the keys to the locale information dictionary;
this is slightly easier to read than the list environment that had been used.
1 parent e0b9deb commit c01f6e6

1 file changed

Lines changed: 43 additions & 68 deletions

File tree

Doc/lib/liblocale.tex

Lines changed: 43 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ \section{\module{locale} ---
4545

4646
\begin{verbatim}
4747
import locale
48-
locale.setlocale(locale.LC_ALL,"")
48+
locale.setlocale(locale.LC_ALL, '')
4949
\end{verbatim}
5050

5151
This sets the locale for all categories to the user's default
@@ -61,75 +61,50 @@ \section{\module{locale} ---
6161
Returns the database of of the local conventions as a dictionary.
6262
This dictionary has the following strings as keys:
6363

64-
\begin{itemize}
65-
\item
66-
\code{'decimal_point'} specifies the decimal point used in floating
67-
point number representations for the \constant{LC_NUMERIC}
68-
category.
69-
70-
\item
71-
\code{'groupin'} is a sequence of numbers specifying at which
72-
relative positions the \code{'thousands_sep'} is expected. If the
73-
sequence is terminated with \constant{CHAR_MAX}, no further
74-
grouping is performed. If the sequence terminates with a \code{0},
75-
the last group size is repeatedly used.
76-
77-
\item
78-
\code{'thousands_sep'} is the character used between groups.
79-
80-
\item
81-
\code{'int_curr_symbol'} specifies the international currency
82-
symbol from the \constant{LC_MONETARY} category.
83-
84-
\item
85-
\code{'currency_symbol'} is the local currency symbol.
86-
87-
\item
88-
\code{'mon_decimal_point'} is the decimal point used in monetary
89-
values.
90-
91-
\item
92-
\code{'mon_thousands_sep'} is the separator for grouping of
93-
monetary values.
94-
95-
\item
96-
\code{'mon_grouping'} has the same format as the \code{'grouping'}
97-
key; it is used for monetary values.
98-
99-
\item
100-
\code{'positive_sign'} and \code{'negative_sign'} gives the sign
101-
used for positive and negative monetary quantities.
102-
103-
\item
104-
\code{'int_frac_digits'} and \code{'frac_digits'} specify the number
105-
of fractional digits used in the international and local
106-
formatting of monetary values.
107-
108-
\item
109-
\code{'p_cs_precedes'} and \code{'n_cs_precedes'} specifies whether
110-
the currency symbol precedes the value for positive or negative
111-
values.
112-
113-
\item
114-
\code{'p_sep_by_space'} and \code{'n_sep_by_space'} specifies
115-
whether there is a space between the positive or negative value
116-
and the currency symbol.
117-
118-
\item
119-
\code{'p_sign_posn'} and \code{'n_sign_posn'} indicate how the
120-
sign should be placed for positive and negative monetary values.
121-
\end{itemize}
122-
123-
The possible values for \code{p_sign_posn} and
124-
\code{n_sign_posn} are given below.
64+
\begin{tableiii}{l|l|p{3in}}{constant}{Key}{Category}{Meaning}
65+
\lineiii{LC_NUMERIC}{\code{'decimal_point'}}
66+
{Decimal point character.}
67+
\lineiii{}{\code{'grouping'}}
68+
{Sequence of numbers specifying which relative positions
69+
the \code{'thousands_sep'} is expected. If the sequence is
70+
terminated with \constant{CHAR_MAX}, no further grouping
71+
is performed. If the sequence terminates with a \code{0},
72+
the last group size is repeatedly used.}
73+
\lineiii{}{\code{'thousands_sep'}}
74+
{Character used between groups.}\hline
75+
\lineiii{LC_MONETARY}{\code{'int_curr_symbol'}}
76+
{International currency symbol.}
77+
\lineiii{}{\code{'currency_symbol'}}
78+
{Local currency symbol.}
79+
\lineiii{}{\code{'mon_decimal_point'}}
80+
{Decimal point used for monetary values.}
81+
\lineiii{}{\code{'mon_thousands_sep'}}
82+
{Group separator used for monetary values.}
83+
\lineiii{}{\code{'mon_grouping'}}
84+
{Equivalent to \code{'grouping'}, used for monetary
85+
values.}
86+
\lineiii{}{\code{'positive_sign'}}
87+
{Symbol used to annotate a positive monetary value.}
88+
\lineiii{}{\code{'negative_sign'}}
89+
{Symbol used to annotate a nnegative monetary value.}
90+
\lineiii{}{\code{'frac_digits'}}
91+
{Number of fractional digits used in local formatting
92+
of monetary values.}
93+
\lineiii{}{\code{'int_frac_digits'}}
94+
{Number of fractional digits used in international
95+
formatting of monetary values.}
96+
\end{tableiii}
97+
98+
The possible values for \code{'p_sign_posn'} and
99+
\code{'n_sign_posn'} are given below.
125100

126101
\begin{tableii}{c|l}{code}{Value}{Explanation}
127102
\lineii{0}{Currency and value are surrounded by parentheses.}
128103
\lineii{1}{The sign should precede the value and currency symbol.}
129104
\lineii{2}{The sign should follow the value and currency symbol.}
130105
\lineii{3}{The sign should immediately precede the value.}
131106
\lineii{4}{The sign should immediately follow the value.}
132-
\lineii{LC_MAX}{Nothing is specified in this locale.}
107+
\lineii{\constant{LC_MAX}}{Nothing is specified in this locale.}
133108
\end{tableii}
134109
\end{funcdesc}
135110

@@ -289,10 +264,10 @@ \section{\module{locale} ---
289264
\begin{verbatim}
290265
>>> import locale
291266
>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
292-
>>> locale.setlocale(locale.LC_ALL, "de") # use German locale
293-
>>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut
294-
>>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale
295-
>>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale
267+
>>> locale.setlocale(locale.LC_ALL, 'de') # use German locale
268+
>>> locale.strcoll('f\344n', 'foo') # compare a string containing an umlaut
269+
>>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
270+
>>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
296271
>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
297272
\end{verbatim}
298273

@@ -308,7 +283,7 @@ \subsection{Background, details, hints, tips and caveats}
308283
Initially, when a program is started, the locale is the \samp{C} locale, no
309284
matter what the user's preferred locale is. The program must
310285
explicitly say that it wants the user's preferred locale settings by
311-
calling \code{setlocale(LC_ALL, "")}.
286+
calling \code{setlocale(LC_ALL, '')}.
312287

313288
It is generally a bad idea to call \function{setlocale()} in some library
314289
routine, since as a side effect it affects the entire program. Saving

0 commit comments

Comments
 (0)