Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{locale} --- |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 2 | Internationalization services} |
| 3 | |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{locale} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 5 | \modulesynopsis{Internationalization services.} |
Fred Drake | 85b5683 | 1999-07-01 16:31:03 +0000 | [diff] [blame^] | 6 | \moduleauthor{Martin von Loewis}{loewis@informatik.hu-berlin.de} |
| 7 | \sectionauthor{Martin von Loewis}{loewis@informatik.hu-berlin.de} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 8 | |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 9 | |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 10 | The \module{locale} module opens access to the \POSIX{} locale database |
Fred Drake | d8a41e6 | 1999-02-19 17:54:10 +0000 | [diff] [blame] | 11 | and functionality. The \POSIX{} locale mechanism allows programmers |
| 12 | to deal with certain cultural issues in an application, without |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 13 | requiring the programmer to know all the specifics of each country |
| 14 | where the software is executed. |
| 15 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 16 | The \module{locale} module is implemented on top of the |
| 17 | \module{_locale}\refbimodindex{_locale} module, which in turn uses an |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 18 | ANSI C locale implementation if available. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 19 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 20 | The \module{locale} module defines the following exception and |
| 21 | functions: |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 22 | |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 23 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 24 | \begin{funcdesc}{setlocale}{category\optional{, value}} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 25 | If \var{value} is specified, modifies the locale setting for the |
| 26 | \var{category}. The available categories are listed in the data |
| 27 | description below. The value is the name of a locale. An empty string |
| 28 | specifies the user's default settings. If the modification of the |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 29 | locale fails, the exception \exception{Error} is |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 30 | raised. If successful, the new locale setting is returned. |
| 31 | |
| 32 | If no \var{value} is specified, the current setting for the |
| 33 | \var{category} is returned. |
| 34 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 35 | \function{setlocale()} is not thread safe on most systems. Applications |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 36 | typically start with a call of |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 37 | \begin{verbatim} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 38 | import locale |
| 39 | locale.setlocale(locale.LC_ALL,"") |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 40 | \end{verbatim} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 41 | This sets the locale for all categories to the user's default setting |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 42 | (typically specified in the \envvar{LANG} environment variable). If |
| 43 | the locale is not changed thereafter, using multithreading should not |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 44 | cause problems. |
| 45 | \end{funcdesc} |
| 46 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 47 | \begin{excdesc}{Error} |
| 48 | Exception raised when \function{setlocale()} fails. |
| 49 | \end{excdesc} |
| 50 | |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 51 | \begin{funcdesc}{localeconv}{} |
| 52 | Returns the database of of the local conventions as a dictionary. This |
| 53 | dictionary has the following strings as keys: |
| 54 | \begin{itemize} |
| 55 | \item \code{decimal_point} specifies the decimal point used in |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 56 | floating point number representations for the \constant{LC_NUMERIC} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 57 | category. |
| 58 | \item \code{grouping} is a sequence of numbers specifying at which |
| 59 | relative positions the \code{thousands_sep} is expected. If the |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 60 | sequence is terminated with \constant{CHAR_MAX}, no further |
Fred Drake | 304474f | 1997-12-17 15:30:07 +0000 | [diff] [blame] | 61 | grouping is performed. If the sequence terminates with a \code{0}, the last |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 62 | group size is repeatedly used. |
| 63 | \item \code{thousands_sep} is the character used between groups. |
| 64 | \item \code{int_curr_symbol} specifies the international currency |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 65 | symbol from the \constant{LC_MONETARY} category. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 66 | \item \code{currency_symbol} is the local currency symbol. |
| 67 | \item \code{mon_decimal_point} is the decimal point used in monetary |
| 68 | values. |
| 69 | \item \code{mon_thousands_sep} is the separator for grouping of |
| 70 | monetary values. |
| 71 | \item \code{mon_grouping} has the same format as the \code{grouping} |
| 72 | key; it is used for monetary values. |
| 73 | \item \code{positive_sign} and \code{negative_sign} gives the sign |
| 74 | used for positive and negative monetary quantities. |
| 75 | \item \code{int_frac_digits} and \code{frac_digits} specify the number |
| 76 | of fractional digits used in the international and local formatting |
| 77 | of monetary values. |
| 78 | \item \code{p_cs_precedes} and \code{n_cs_precedes} specifies whether |
| 79 | the currency symbol precedes the value for positive or negative |
| 80 | values. |
| 81 | \item \code{p_sep_by_space} and \code{n_sep_by_space} specifies |
| 82 | whether there is a space between the positive or negative value and |
| 83 | the currency symbol. |
| 84 | \item \code{p_sign_posn} and \code{n_sign_posn} indicate how the |
| 85 | sign should be placed for positive and negative monetary values. |
| 86 | \end{itemize} |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 87 | |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 88 | The possible values for \code{p_sign_posn} and |
| 89 | \code{n_sign_posn} are given below. |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 90 | |
Fred Drake | ee60191 | 1998-04-11 20:53:03 +0000 | [diff] [blame] | 91 | \begin{tableii}{c|l}{code}{Value}{Explanation} |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 92 | \lineii{0}{Currency and value are surrounded by parentheses.} |
| 93 | \lineii{1}{The sign should precede the value and currency symbol.} |
| 94 | \lineii{2}{The sign should follow the value and currency symbol.} |
| 95 | \lineii{3}{The sign should immediately precede the value.} |
| 96 | \lineii{4}{The sign should immediately follow the value.} |
| 97 | \lineii{LC_MAX}{Nothing is specified in this locale.} |
| 98 | \end{tableii} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 99 | \end{funcdesc} |
| 100 | |
| 101 | \begin{funcdesc}{strcoll}{string1,string2} |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 102 | Compares two strings according to the current \constant{LC_COLLATE} |
Fred Drake | 304474f | 1997-12-17 15:30:07 +0000 | [diff] [blame] | 103 | setting. As any other compare function, returns a negative, or a |
| 104 | positive value, or \code{0}, depending on whether \var{string1} |
| 105 | collates before or after \var{string2} or is equal to it. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 106 | \end{funcdesc} |
| 107 | |
| 108 | \begin{funcdesc}{strxfrm}{string} |
Fred Drake | dc40904 | 1998-04-02 18:54:54 +0000 | [diff] [blame] | 109 | Transforms a string to one that can be used for the built-in function |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 110 | \function{cmp()}\bifuncindex{cmp}, and still returns locale-aware |
| 111 | results. This function can be used when the same string is compared |
| 112 | repeatedly, e.g. when collating a sequence of strings. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 113 | \end{funcdesc} |
| 114 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 115 | \begin{funcdesc}{format}{format, val, \optional{grouping\code{ = 0}}} |
| 116 | Formats a number \var{val} according to the current |
| 117 | \constant{LC_NUMERIC} setting. The format follows the conventions of |
| 118 | the \code{\%} operator. For floating point values, the decimal point |
| 119 | is modified if appropriate. If \var{grouping} is true, also takes the |
| 120 | grouping into account. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 121 | \end{funcdesc} |
| 122 | |
| 123 | \begin{funcdesc}{str}{float} |
Fred Drake | 304474f | 1997-12-17 15:30:07 +0000 | [diff] [blame] | 124 | Formats a floating point number using the same format as the built-in |
| 125 | function \code{str(\var{float})}, but takes the decimal point into |
| 126 | account. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 127 | \end{funcdesc} |
| 128 | |
| 129 | \begin{funcdesc}{atof}{string} |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 130 | Converts a string to a floating point number, following the |
| 131 | \constant{LC_NUMERIC} settings. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 132 | \end{funcdesc} |
| 133 | |
| 134 | \begin{funcdesc}{atoi}{string} |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 135 | Converts a string to an integer, following the \constant{LC_NUMERIC} |
| 136 | conventions. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 137 | \end{funcdesc} |
| 138 | |
| 139 | \begin{datadesc}{LC_CTYPE} |
Fred Drake | 304474f | 1997-12-17 15:30:07 +0000 | [diff] [blame] | 140 | \refstmodindex{string} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 141 | Locale category for the character type functions. Depending on the |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 142 | settings of this category, the functions of module \refmodule{string} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 143 | dealing with case change their behaviour. |
| 144 | \end{datadesc} |
| 145 | |
| 146 | \begin{datadesc}{LC_COLLATE} |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 147 | Locale category for sorting strings. The functions |
| 148 | \function{strcoll()} and \function{strxfrm()} of the \module{locale} |
| 149 | module are affected. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 150 | \end{datadesc} |
| 151 | |
| 152 | \begin{datadesc}{LC_TIME} |
| 153 | Locale category for the formatting of time. The function |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 154 | \function{time.strftime()} follows these conventions. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 155 | \end{datadesc} |
| 156 | |
| 157 | \begin{datadesc}{LC_MONETARY} |
| 158 | Locale category for formatting of monetary values. The available |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 159 | options are available from the \function{localeconv()} function. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 160 | \end{datadesc} |
| 161 | |
| 162 | \begin{datadesc}{LC_MESSAGES} |
| 163 | Locale category for message display. Python currently does not support |
| 164 | application specific locale-aware messages. Messages displayed by the |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 165 | operating system, like those returned by \function{os.strerror()} |
| 166 | might be affected by this category. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 167 | \end{datadesc} |
| 168 | |
| 169 | \begin{datadesc}{LC_NUMERIC} |
| 170 | Locale category for formatting numbers. The functions |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 171 | \function{format()}, \function{atoi()}, \function{atof()} and |
| 172 | \function{str()} of the \module{locale} module are affected by that |
| 173 | category. All other numeric formatting operations are not affected. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 174 | \end{datadesc} |
| 175 | |
| 176 | \begin{datadesc}{LC_ALL} |
| 177 | Combination of all locale settings. If this flag is used when the |
| 178 | locale is changed, setting the locale for all categories is |
| 179 | attempted. If that fails for any category, no category is changed at |
| 180 | all. When the locale is retrieved using this flag, a string indicating |
| 181 | the setting for all categories is returned. This string can be later |
| 182 | used to restore the settings. |
| 183 | \end{datadesc} |
| 184 | |
| 185 | \begin{datadesc}{CHAR_MAX} |
| 186 | This is a symbolic constant used for different values returned by |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 187 | \function{localeconv()}. |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 188 | \end{datadesc} |
| 189 | |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 190 | Example: |
| 191 | |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 192 | \begin{verbatim} |
Guido van Rossum | bc12f78 | 1997-11-20 21:04:27 +0000 | [diff] [blame] | 193 | >>> import locale |
Guido van Rossum | d028ca9 | 1998-02-22 04:41:51 +0000 | [diff] [blame] | 194 | >>> loc = locale.setlocale(locale.LC_ALL) # get current locale |
| 195 | >>> locale.setlocale(locale.LC_ALL, "de") # use German locale |
| 196 | >>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut |
| 197 | >>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale |
| 198 | >>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale |
| 199 | >>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 200 | \end{verbatim} |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 201 | |
| 202 | \subsection{Background, details, hints, tips and caveats} |
| 203 | |
| 204 | The C standard defines the locale as a program-wide property that may |
| 205 | be relatively expensive to change. On top of that, some |
| 206 | implementation are broken in such a way that frequent locale changes |
| 207 | may cause core dumps. This makes the locale somewhat painful to use |
| 208 | correctly. |
| 209 | |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 210 | Initially, when a program is started, the locale is the \samp{C} locale, no |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 211 | matter what the user's preferred locale is. The program must |
| 212 | explicitly say that it wants the user's preferred locale settings by |
| 213 | calling \code{setlocale(LC_ALL, "")}. |
| 214 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 215 | It is generally a bad idea to call \function{setlocale()} in some library |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 216 | routine, since as a side effect it affects the entire program. Saving |
| 217 | and restoring it is almost as bad: it is expensive and affects other |
| 218 | threads that happen to run before the settings have been restored. |
| 219 | |
| 220 | If, when coding a module for general use, you need a locale |
| 221 | independent version of an operation that is affected by the locale |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 222 | (e.g. \function{string.lower()}, or certain formats used with |
| 223 | \function{time.strftime()})), you will have to find a way to do it |
| 224 | without using the standard library routine. Even better is convincing |
| 225 | yourself that using locale settings is okay. Only as a last resort |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 226 | should you document that your module is not compatible with |
| 227 | non-\samp{C} locale settings. |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 228 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 229 | The case conversion functions in the |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 230 | \refmodule{string}\refstmodindex{string} and |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 231 | \module{strop}\refbimodindex{strop} modules are affected by the locale |
| 232 | settings. When a call to the \function{setlocale()} function changes |
| 233 | the \constant{LC_CTYPE} settings, the variables |
| 234 | \code{string.lowercase}, \code{string.uppercase} and |
| 235 | \code{string.letters} (and their counterparts in \module{strop}) are |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 236 | recalculated. Note that this code that uses these variable through |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 237 | `\keyword{from} ... \keyword{import} ...', e.g. \code{from string |
| 238 | import letters}, is not affected by subsequent \function{setlocale()} |
| 239 | calls. |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 240 | |
| 241 | The only way to perform numeric operations according to the locale |
| 242 | is to use the special functions defined by this module: |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 243 | \function{atof()}, \function{atoi()}, \function{format()}, |
| 244 | \function{str()}. |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 245 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 246 | \subsection{For extension writers and programs that embed Python} |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 247 | \label{embedding-locale} |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 248 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 249 | Extension modules should never call \function{setlocale()}, except to |
| 250 | find out what the current locale is. But since the return value can |
| 251 | only be used portably to restore it, that is not very useful (except |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 252 | perhaps to find out whether or not the locale is \samp{C}). |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 253 | |
| 254 | When Python is embedded in an application, if the application sets the |
| 255 | locale to something specific before initializing Python, that is |
| 256 | generally okay, and Python will use whatever locale is set, |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 257 | \emph{except} that the \constant{LC_NUMERIC} locale should always be |
| 258 | \samp{C}. |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 259 | |
Fred Drake | 85b5683 | 1999-07-01 16:31:03 +0000 | [diff] [blame^] | 260 | The \function{setlocale()} function in the \module{locale} module |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 261 | gives the Python progammer the impression that you can manipulate the |
Fred Drake | c3845a1 | 1999-04-21 17:18:04 +0000 | [diff] [blame] | 262 | \constant{LC_NUMERIC} locale setting, but this not the case at the C |
| 263 | level: C code will always find that the \constant{LC_NUMERIC} locale |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 264 | setting is \samp{C}. This is because too much would break when the |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 265 | decimal point character is set to something else than a period |
| 266 | (e.g. the Python parser would break). Caveat: threads that run |
| 267 | without holding Python's global interpreter lock may occasionally find |
| 268 | that the numeric locale setting differs; this is because the only |
| 269 | portable way to implement this feature is to set the numeric locale |
| 270 | settings to what the user requests, extract the relevant |
Fred Drake | 9fee071 | 1998-04-03 06:21:23 +0000 | [diff] [blame] | 271 | characteristics, and then restore the \samp{C} numeric locale. |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 272 | |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 273 | When Python code uses the \module{locale} module to change the locale, |
Fred Drake | d8a41e6 | 1999-02-19 17:54:10 +0000 | [diff] [blame] | 274 | this also affects the embedding application. If the embedding |
Guido van Rossum | 3ffb715 | 1998-02-22 04:23:51 +0000 | [diff] [blame] | 275 | application doesn't want this to happen, it should remove the |
Fred Drake | 193338a | 1998-03-10 04:23:12 +0000 | [diff] [blame] | 276 | \module{_locale} extension module (which does all the work) from the |
| 277 | table of built-in modules in the \file{config.c} file, and make sure |
| 278 | that the \module{_locale} module is not accessible as a shared library. |