@@ -34,12 +34,18 @@ The :mod:`locale` module defines the following exception and functions:
3434
3535 If *locale * is given and not ``None ``, :func: `setlocale ` modifies the locale
3636 setting for the *category *. The available categories are listed in the data
37- description below. *locale * may be a string, or an iterable of two strings
38- ( language code and encoding) . If it's an iterable , it's converted to a locale
37+ description below. *locale * may be a string, or a pair,
38+ language code and encoding. If it is a pair , it is converted to a locale
3939 name using the locale aliasing engine. An empty string specifies the user's
4040 default settings. If the modification of the locale fails, the exception
4141 :exc: `Error ` is raised. If successful, the new locale setting is returned.
4242
43+ The format of the *locale * and the language code strings is platform
44+ depended, but the forms ``language[_territory][.encoding][@modifier] ``
45+ and ``language[_territory] `` respectively are typically accepted on all
46+ platforms.
47+ The language code and encoding can be ``None ``.
48+
4349 If *locale * is omitted or ``None ``, the current setting for *category * is
4450 returned.
4551
@@ -345,22 +351,26 @@ The :mod:`locale` module defines the following exception and functions:
345351 ``'LANG' ``. The GNU gettext search path contains ``'LC_ALL' ``,
346352 ``'LC_CTYPE' ``, ``'LANG' `` and ``'LANGUAGE' ``, in that order.
347353
348- Except for the code ``'C' ``, the language code corresponds to :rfc: `1766 `.
349- *language code * and *encoding * may be ``None `` if their values cannot be
354+ The format of the language code is platform depended, but on Posix
355+ platforms it usually looks like ``language[_territory] ``.
356+ The language code and encoding may be ``None `` if their values cannot be
350357 determined.
358+ The "C" locale is represented as ``(None, None) ``.
351359
352360 .. deprecated-removed :: 3.11 3.15
353361
354362
355363.. function :: getlocale(category=LC_CTYPE)
356364
357- Returns the current setting for the given locale category as sequence containing
358- * language code *, * encoding * . *category * may be one of the :const: `!LC_\* ` values
365+ Returns the current setting for the given locale category as a tuple containing
366+ language code and encoding. *category * may be one of the :const: `!LC_\* ` values
359367 except :const: `LC_ALL `. It defaults to :const: `LC_CTYPE `.
360368
361- Except for the code ``'C' ``, the language code corresponds to :rfc: `1766 `.
362- *language code * and *encoding * may be ``None `` if their values cannot be
369+ The format of the language code is platform depended, but on Posix
370+ platforms it usually looks like ``language[_territory] ``.
371+ The language code and encoding may be ``None `` if their values cannot be
363372 determined.
373+ The "C" locale is represented as ``(None, None) ``.
364374
365375
366376.. function :: getpreferredencoding(do_setlocale=True)
0 commit comments