Changeset 391 for python/trunk/Doc/library/locale.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/library/locale.rst
r2 r391 24 24 .. exception:: Error 25 25 26 Exception raised when :func:`setlocale` fails. 26 Exception raised when the locale passed to :func:`setlocale` is not 27 recognized. 27 28 28 29 29 30 .. function:: setlocale(category[, locale]) 30 31 31 If *locale* is specified, it may be a string, a tuple of the form ``(language 32 code, encoding)``, or ``None``. If it is a tuple, it is converted to a string 33 using the locale aliasing engine. If *locale* is given and not ``None``, 34 :func:`setlocale` modifies the locale setting for the *category*. The available 35 categories are listed in the data description below. The value is the name of a 36 locale. An empty string specifies the user's default settings. If the 37 modification of the locale fails, the exception :exc:`Error` is raised. If 38 successful, the new locale setting is returned. 32 If *locale* is given and not ``None``, :func:`setlocale` modifies the locale 33 setting for the *category*. The available categories are listed in the data 34 description below. *locale* may be a string, or an iterable of two strings 35 (language code and encoding). If it's an iterable, it's converted to a locale 36 name using the locale aliasing engine. An empty string specifies the user's 37 default settings. If the modification of the locale fails, the exception 38 :exc:`Error` is raised. If successful, the new locale setting is returned. 39 39 40 40 If *locale* is omitted or ``None``, the current setting for *category* is 41 41 returned. 42 42 43 :func:`setlocale` is not thread 43 :func:`setlocale` is not thread-safe on most systems. Applications typically 44 44 start with a call of :: 45 45 … … 52 52 53 53 .. versionchanged:: 2.0 54 Added support for tuple values of the *locale* parameter.54 Added support for iterable values of the *locale* parameter. 55 55 56 56 … … 59 59 Returns the database of the local conventions as a dictionary. This dictionary 60 60 has the following strings as keys: 61 62 .. tabularcolumns:: |l|l|L| 61 63 62 64 +----------------------+-------------------------------------+--------------------------------+ … … 165 167 .. data:: D_T_FMT 166 168 167 Get a string that can be used as a format string for :func:` strftime` to168 represent time and date in a locale-specific way.169 Get a string that can be used as a format string for :func:`time.strftime` to 170 represent date and time in a locale-specific way. 169 171 170 172 .. data:: D_FMT 171 173 172 Get a string that can be used as a format string for :func:` strftime` to174 Get a string that can be used as a format string for :func:`time.strftime` to 173 175 represent a date in a locale-specific way. 174 176 175 177 .. data:: T_FMT 176 178 177 Get a string that can be used as a format string for :func:` strftime` to179 Get a string that can be used as a format string for :func:`time.strftime` to 178 180 represent a time in a locale-specific way. 179 181 180 182 .. data:: T_FMT_AMPM 181 183 182 Get a format string for :func:` strftime` to represent time in the am/pm184 Get a format string for :func:`time.strftime` to represent time in the am/pm 183 185 format. 184 186 … … 220 222 .. note:: 221 223 222 The expression is in the syntax suitable for the :c func:`regex` function224 The expression is in the syntax suitable for the :c:func:`regex` function 223 225 from the C library, which might differ from the syntax used in :mod:`re`. 224 226 … … 244 246 245 247 Normally it should not be necessary to use this value directly. Specifying 246 the ``E`` modifier in their format strings causes the :func:` strftime`248 the ``E`` modifier in their format strings causes the :func:`time.strftime` 247 249 function to use this information. The format of the returned string is not 248 250 specified, and therefore you should not assume knowledge of it on different 249 251 systems. 250 252 251 .. data:: ERA_YEAR252 253 Get the year in the relevant era of the locale.254 255 253 .. data:: ERA_D_T_FMT 256 254 257 Get a format string for :func:` strftime` to represent dates and timesin a255 Get a format string for :func:`time.strftime` to represent date and time in a 258 256 locale-specific era-based way. 259 257 260 258 .. data:: ERA_D_FMT 261 259 262 Get a format string for :func:`strftime` to represent time in a 260 Get a format string for :func:`time.strftime` to represent a date in a 261 locale-specific era-based way. 262 263 .. data:: ERA_T_FMT 264 265 Get a format string for :func:`time.strftime` to represent a time in a 263 266 locale-specific era-based way. 264 267 … … 559 562 Python applications should normally find no need to invoke these functions, and 560 563 should use :mod:`gettext` instead. A known exception to this rule are 561 applications that link useadditional C libraries which internally invoke562 :c func:`gettext` or :func:`dcgettext`. For these applications, it may be564 applications that link with additional C libraries which internally invoke 565 :c:func:`gettext` or :func:`dcgettext`. For these applications, it may be 563 566 necessary to bind the text domain, so that the libraries can properly locate 564 567 their message catalogs.
Note:
See TracChangeset
for help on using the changeset viewer.