{
    "content": [
        {
            "type": "text",
            "text": "# locale (pydoc)\n\n## TLDR\n\n> Get locale-specific information.\n\n- List all global environment variables describing the user's locale:\n  `locale`\n- List all available locales:\n  `locale {{-a|--all-locales}}`\n- Display all available locales and the associated metadata:\n  `locale {{-a|--all-locales}} {{-v|--verbose}}`\n- Display the current date format:\n  `locale date_fmt`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** locale - Locale support module.\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **MODULE REFERENCE** (8 lines)\n- **DESCRIPTION** (8 lines)\n- **CLASSES** (3 lines) — 1 subsections\n  - class Error (67 lines)\n- **FUNCTIONS** (1 lines) — 15 subsections\n  - atof (2 lines)\n  - atoi (2 lines)\n  - currency (3 lines)\n  - format (2 lines)\n  - format_string (7 lines)\n  - getdefaultlocale (20 lines)\n  - getlocale (10 lines)\n  - getpreferredencoding (3 lines)\n  - localeconv (2 lines)\n  - normalize (13 lines)\n  - resetlocale (5 lines)\n  - setlocale (9 lines)\n  - str (2 lines)\n  - strcoll (2 lines)\n  - strxfrm (2 lines)\n- **DATA** (10 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nlocale - Locale support module.\n\n### MODULE REFERENCE\n\nhttps://docs.python.org/3.10/library/locale.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n\n### DESCRIPTION\n\nThe module provides low-level access to the C lib's locale APIs and adds high\nlevel number formatting APIs as well as a locale aliasing engine to complement\nthese.\n\nThe aliasing engine includes support for many commonly used locale names and\nmaps them to values suitable for passing to the C lib's setlocale() function. It\nalso includes default encodings for all supported locale names.\n\n### CLASSES\n\nbuiltins.Exception(builtins.BaseException)\nError\n\n#### class Error\n\n|  Method resolution order:\n|      Error\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.Exception:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n\n### FUNCTIONS\n\n#### atof\n\nParses a string as a float according to the locale settings.\n\n#### atoi\n\nConverts a string to an integer according to the locale settings.\n\n#### currency\n\nFormats val according to the currency settings\nin the current locale.\n\n#### format\n\nDeprecated, use formatstring instead.\n\n#### format_string\n\nFormats a string in the same way that the % formatting would use,\nbut takes the current locale into account.\n\nGrouping is applied if the third parameter is true.\nConversion uses monetary thousands separator and grouping strings if\nforth parameter monetary is true.\n\n#### getdefaultlocale\n\nTries to determine the default locale settings and returns\nthem as tuple (language code, encoding).\n\nAccording to POSIX, a program which has not called\nsetlocale(LCALL, \"\") runs using the portable 'C' locale.\nCalling setlocale(LCALL, \"\") lets it use the default locale as\ndefined by the LANG variable. Since we don't want to interfere\nwith the current locale setting we thus emulate the behavior\nin the way described above.\n\nTo maintain compatibility with other platforms, not only the\nLANG variable is tested, but a list of variables given as\nenvvars parameter. The first found to be defined will be\nused. envvars defaults to the search path used in GNU gettext;\nit must always contain the variable name 'LANG'.\n\nExcept for the code 'C', the language code corresponds to RFC\n1766.  code and encoding can be None in case the values cannot\nbe determined.\n\n#### getlocale\n\nReturns the current setting for the given locale category as\ntuple (language code, encoding).\n\ncategory may be one of the LC* value except LCALL. It\ndefaults to LCCTYPE.\n\nExcept for the code 'C', the language code corresponds to RFC\n1766.  code and encoding can be None in case the values cannot\nbe determined.\n\n#### getpreferredencoding\n\nReturn the charset that the user is likely using,\naccording to the system configuration.\n\n#### localeconv\n\nReturns numeric and monetary locale-specific parameters.\n\n#### normalize\n\nReturns a normalized locale code for the given locale\nname.\n\nThe returned locale code is formatted for use with\nsetlocale().\n\nIf normalization fails, the original name is returned\nunchanged.\n\nIf the given encoding is not known, the function defaults to\nthe default encoding for the locale code just like setlocale()\ndoes.\n\n#### resetlocale\n\nSets the locale for category to the default setting.\n\nThe default setting is determined by calling\ngetdefaultlocale(). category defaults to LCALL.\n\n#### setlocale\n\nSet the locale for the given category.  The locale can be\na string, an iterable of two strings (language code and encoding),\nor None.\n\nIterables are converted to strings using the locale aliasing\nengine.  Locale strings are passed directly to the C lib.\n\ncategory may be given as one of the LC* values.\n\n#### str\n\nConvert float to string, taking the locale into account.\n\n#### strcoll\n\nCompares two strings according to the locale.\n\n#### strxfrm\n\nReturn a string that can be used as a key for locale-aware comparisons.\n\n### DATA\n\nCHARMAX = 127\nLCALL = 6\nLCCOLLATE = 3\nLCCTYPE = 0\nLCMESSAGES = 5\nLCMONETARY = 4\nLCNUMERIC = 1\nLCTIME = 2\nall = ['getlocale', 'getdefaultlocale', 'getpreferredencoding', 'E...\n\n### FILE\n\n/usr/lib/python3.10/locale.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "locale",
        "section": "",
        "mode": "pydoc",
        "summary": "locale - Locale support module.",
        "synopsis": null,
        "tldr_summary": "Get locale-specific information.",
        "tldr_examples": [
            {
                "description": "List all global environment variables describing the user's locale",
                "command": "locale"
            },
            {
                "description": "List all available locales",
                "command": "locale {{-a|--all-locales}}"
            },
            {
                "description": "Display all available locales and the associated metadata",
                "command": "locale {{-a|--all-locales}} {{-v|--verbose}}"
            },
            {
                "description": "Display the current date format",
                "command": "locale date_fmt"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "class Error",
                        "lines": 67
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "atof",
                        "lines": 2
                    },
                    {
                        "name": "atoi",
                        "lines": 2
                    },
                    {
                        "name": "currency",
                        "lines": 3
                    },
                    {
                        "name": "format",
                        "lines": 2
                    },
                    {
                        "name": "format_string",
                        "lines": 7
                    },
                    {
                        "name": "getdefaultlocale",
                        "lines": 20
                    },
                    {
                        "name": "getlocale",
                        "lines": 10
                    },
                    {
                        "name": "getpreferredencoding",
                        "lines": 3
                    },
                    {
                        "name": "localeconv",
                        "lines": 2
                    },
                    {
                        "name": "normalize",
                        "lines": 13
                    },
                    {
                        "name": "resetlocale",
                        "lines": 5
                    },
                    {
                        "name": "setlocale",
                        "lines": 9
                    },
                    {
                        "name": "str",
                        "lines": 2
                    },
                    {
                        "name": "strcoll",
                        "lines": 2
                    },
                    {
                        "name": "strxfrm",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}