summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-11-30 07:13:58 (GMT)
committerFred Drake <fdrake@acm.org>2000-11-30 07:13:58 (GMT)
commitc01f6e691b0a1c1c8d1f645e703fb9959956b2b3 (patch)
treef4126540c49133beb08556fbb1ad1d0d2c31f6ee
parente0b9deb3ce94391f3b571d5e42c8ce0bdaab4bfc (diff)
downloadcpython-c01f6e691b0a1c1c8d1f645e703fb9959956b2b3.zip
cpython-c01f6e691b0a1c1c8d1f645e703fb9959956b2b3.tar.gz
cpython-c01f6e691b0a1c1c8d1f645e703fb9959956b2b3.tar.bz2
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.
-rw-r--r--Doc/lib/liblocale.tex111
1 files changed, 43 insertions, 68 deletions
diff --git a/Doc/lib/liblocale.tex b/Doc/lib/liblocale.tex
index 7f40f06..974d696 100644
--- a/Doc/lib/liblocale.tex
+++ b/Doc/lib/liblocale.tex
@@ -45,7 +45,7 @@ functions:
\begin{verbatim}
import locale
-locale.setlocale(locale.LC_ALL,"")
+locale.setlocale(locale.LC_ALL, '')
\end{verbatim}
This sets the locale for all categories to the user's default
@@ -61,67 +61,42 @@ locale.setlocale(locale.LC_ALL,"")
Returns the database of of the local conventions as a dictionary.
This dictionary has the following strings as keys:
- \begin{itemize}
- \item
- \code{'decimal_point'} specifies the decimal point used in floating
- point number representations for the \constant{LC_NUMERIC}
- category.
-
- \item
- \code{'groupin'} is a sequence of numbers specifying at which
- relative positions the \code{'thousands_sep'} is expected. If the
- sequence is terminated with \constant{CHAR_MAX}, no further
- grouping is performed. If the sequence terminates with a \code{0},
- the last group size is repeatedly used.
-
- \item
- \code{'thousands_sep'} is the character used between groups.
-
- \item
- \code{'int_curr_symbol'} specifies the international currency
- symbol from the \constant{LC_MONETARY} category.
-
- \item
- \code{'currency_symbol'} is the local currency symbol.
-
- \item
- \code{'mon_decimal_point'} is the decimal point used in monetary
- values.
-
- \item
- \code{'mon_thousands_sep'} is the separator for grouping of
- monetary values.
-
- \item
- \code{'mon_grouping'} has the same format as the \code{'grouping'}
- key; it is used for monetary values.
-
- \item
- \code{'positive_sign'} and \code{'negative_sign'} gives the sign
- used for positive and negative monetary quantities.
-
- \item
- \code{'int_frac_digits'} and \code{'frac_digits'} specify the number
- of fractional digits used in the international and local
- formatting of monetary values.
-
- \item
- \code{'p_cs_precedes'} and \code{'n_cs_precedes'} specifies whether
- the currency symbol precedes the value for positive or negative
- values.
-
- \item
- \code{'p_sep_by_space'} and \code{'n_sep_by_space'} specifies
- whether there is a space between the positive or negative value
- and the currency symbol.
-
- \item
- \code{'p_sign_posn'} and \code{'n_sign_posn'} indicate how the
- sign should be placed for positive and negative monetary values.
- \end{itemize}
-
- The possible values for \code{p_sign_posn} and
- \code{n_sign_posn} are given below.
+ \begin{tableiii}{l|l|p{3in}}{constant}{Key}{Category}{Meaning}
+ \lineiii{LC_NUMERIC}{\code{'decimal_point'}}
+ {Decimal point character.}
+ \lineiii{}{\code{'grouping'}}
+ {Sequence of numbers specifying which relative positions
+ the \code{'thousands_sep'} is expected. If the sequence is
+ terminated with \constant{CHAR_MAX}, no further grouping
+ is performed. If the sequence terminates with a \code{0},
+ the last group size is repeatedly used.}
+ \lineiii{}{\code{'thousands_sep'}}
+ {Character used between groups.}\hline
+ \lineiii{LC_MONETARY}{\code{'int_curr_symbol'}}
+ {International currency symbol.}
+ \lineiii{}{\code{'currency_symbol'}}
+ {Local currency symbol.}
+ \lineiii{}{\code{'mon_decimal_point'}}
+ {Decimal point used for monetary values.}
+ \lineiii{}{\code{'mon_thousands_sep'}}
+ {Group separator used for monetary values.}
+ \lineiii{}{\code{'mon_grouping'}}
+ {Equivalent to \code{'grouping'}, used for monetary
+ values.}
+ \lineiii{}{\code{'positive_sign'}}
+ {Symbol used to annotate a positive monetary value.}
+ \lineiii{}{\code{'negative_sign'}}
+ {Symbol used to annotate a nnegative monetary value.}
+ \lineiii{}{\code{'frac_digits'}}
+ {Number of fractional digits used in local formatting
+ of monetary values.}
+ \lineiii{}{\code{'int_frac_digits'}}
+ {Number of fractional digits used in international
+ formatting of monetary values.}
+ \end{tableiii}
+
+ The possible values for \code{'p_sign_posn'} and
+ \code{'n_sign_posn'} are given below.
\begin{tableii}{c|l}{code}{Value}{Explanation}
\lineii{0}{Currency and value are surrounded by parentheses.}
@@ -129,7 +104,7 @@ locale.setlocale(locale.LC_ALL,"")
\lineii{2}{The sign should follow the value and currency symbol.}
\lineii{3}{The sign should immediately precede the value.}
\lineii{4}{The sign should immediately follow the value.}
- \lineii{LC_MAX}{Nothing is specified in this locale.}
+ \lineii{\constant{LC_MAX}}{Nothing is specified in this locale.}
\end{tableii}
\end{funcdesc}
@@ -289,10 +264,10 @@ Example:
\begin{verbatim}
>>> import locale
>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
->>> locale.setlocale(locale.LC_ALL, "de") # use German locale
->>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut
->>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale
->>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale
+>>> locale.setlocale(locale.LC_ALL, 'de') # use German locale
+>>> locale.strcoll('f\344n', 'foo') # compare a string containing an umlaut
+>>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
+>>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
\end{verbatim}
@@ -308,7 +283,7 @@ correctly.
Initially, when a program is started, the locale is the \samp{C} locale, no
matter what the user's preferred locale is. The program must
explicitly say that it wants the user's preferred locale settings by
-calling \code{setlocale(LC_ALL, "")}.
+calling \code{setlocale(LC_ALL, '')}.
It is generally a bad idea to call \function{setlocale()} in some library
routine, since as a side effect it affects the entire program. Saving