{
    "mode": "man",
    "parameter": "locale",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/locale/7/json",
    "generated": "2026-05-30T06:06:45Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "locale - description of multilanguage support\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <locale.h>",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "A  locale  is a set of language and cultural rules.  These cover aspects such as language for\nmessages, different character sets, lexicographic conventions, and so on.  A program needs to\nbe able to determine its locale and act accordingly to be portable to different cultures.\n\nThe  header  <locale.h>  declares  data  types, functions and macros which are useful in this\ntask.\n\nThe functions it declares are setlocale(3) to set the current locale,  and  localeconv(3)  to\nget information about number formatting.\n\nThere are different categories for locale information a program might need; they are declared\nas macros.  Using them as the first argument to the setlocale(3) function, it is possible  to\nset one of these to the desired locale:\n\nLCADDRESS (GNU extension, since glibc 2.2)\nChange  settings  that  describe the formats (e.g., postal addresses) used to describe\nlocations and geography-related items.  Applications that need  this  information  can\nuse  nllanginfo(3) to retrieve nonstandard elements, such as NLADDRESSCOUNTRYNAME\n(country name, in the language of  the  locale)  and  NLADDRESSLANGNAME  (language\nname,  in  the language of the locale), which return strings such as \"Deutschland\" and\n\"Deutsch\" (for German-language locales).  (Other element names are  listed  in  <lang‐\ninfo.h>.)\n\nLCCOLLATE\nThis  category  governs  the collation rules used for sorting and regular expressions,\nincluding character equivalence classes and multicharacter collating  elements.   This\nlocale category changes the behavior of the functions strcoll(3) and strxfrm(3), which\nare used to compare strings in the local alphabet.  For example, the German sharp s is\nsorted as \"ss\".\n\nLCCTYPE\nThis  category  determines  the  interpretation of byte sequences as characters (e.g.,\nsingle versus multibyte characters), character classifications  (e.g.,  alphabetic  or\ndigit),  and  the behavior of character classes.  On glibc systems, this category also\ndetermines the character transliteration rules for iconv(1) and iconv(3).  It  changes\nthe  behavior  of  the  character handling and classification functions, such as isup‐‐\nper(3) and toupper(3), and the multibyte character functions such as mblen(3)  or  wc‐‐\ntomb(3).\n\nLCIDENTIFICATION (GNU extension, since glibc 2.2)\nChange  settings  that  relate to the metadata for the locale.  Applications that need\nthis information can use nllanginfo(3) to  retrieve  nonstandard  elements,  such  as\nNLIDENTIFICATIONTITLE (title of this locale document) and NLIDENTIFICATIONTERRI‐‐\nTORY (geographical territory to which this locale document applies), which  might  re‐\nturn strings such as \"English locale for the USA\" and \"USA\".  (Other element names are\nlisted in <langinfo.h>.)\n\nLCMONETARY\nThis category determines the formatting  used  for  monetary-related  numeric  values.\nThis  changes  the information returned by localeconv(3), which describes the way num‐\nbers are usually printed, with details such as decimal  point  versus  decimal  comma.\nThis information is internally used by the function strfmon(3).\n\nLCMESSAGES\nThis  category affects the language in which messages are displayed and what an affir‐\nmative or negative answer looks like.  The GNU  C  library  contains  the  gettext(3),\nngettext(3),  and  rpmatch(3)  functions to ease the use of this information.  The GNU\ngettext family of functions also obey the environment variable LANGUAGE (containing  a\ncolon-separated  list  of locales) if the category is set to a valid locale other than\n\"C\".  This category also affects the behavior of catopen(3).\n\nLCMEASUREMENT (GNU extension, since glibc 2.2)\nChange the settings relating to the measurement system in  the  locale  (i.e.,  metric\nversus  US customary units).  Applications can use nllanginfo(3) to retrieve the non‐\nstandard NLMEASUREMENTMEASUREMENT element, which returns a pointer to  a  character\nthat has the value 1 (metric) or 2 (US customary units).\n\nLCNAME (GNU extension, since glibc 2.2)\nChange  settings that describe the formats used to address persons.  Applications that\nneed this information can use nllanginfo(3) to retrieve nonstandard elements, such as\nNLNAMENAMEMR (general salutation for men) and NLNAMENAMEMS (general salutation\nfor women) elements, which return strings such as \"Herr\" and \"Frau\"  (for  German-lan‐\nguage locales).  (Other element names are listed in <langinfo.h>.)\n\nLCNUMERIC\nThis  category determines the formatting rules used for nonmonetary numeric values—for\nexample, the thousands separator and the radix character (a period  in  most  English-\nspeaking  countries, but a comma in many other regions).  It affects functions such as\nprintf(3), scanf(3), and strtod(3).  This information can also be read  with  the  lo‐‐\ncaleconv(3) function.\n\nLCPAPER (GNU extension, since glibc 2.2)\nChange  the  settings  relating to the dimensions of the standard paper size (e.g., US\nletter versus A4).  Applications that need the dimensions can  obtain  them  by  using\nnllanginfo(3)  to  retrieve the nonstandard NLPAPERWIDTH and NLPAPERHEIGHT ele‐\nments, which return int values specifying the dimensions in millimeters.\n\nLCTELEPHONE (GNU extension, since glibc 2.2)\nChange settings that describe the formats to be used with telephone services.   Appli‐\ncations that need this information can use nllanginfo(3) to retrieve nonstandard ele‐\nments, such as NLTELEPHONEINTPREFIX (international prefix used to call numbers  in\nthis locale), which returns a string such as \"49\" (for Germany).  (Other element names\nare listed in <langinfo.h>.)\n\nLCTIME\nThis category governs the formatting used for date and time values.  For example, most\nof  Europe  uses  a  24-hour clock versus the 12-hour clock used in the United States.\nThe setting of this category affects the behavior of functions such as strftime(3) and\nstrptime(3).\n\nLCALL All of the above.\n\nIf  the second argument to setlocale(3) is an empty string, \"\", for the default locale, it is\ndetermined using the following steps:\n\n1. If there is a non-null environment variable LCALL, the value of LCALL is used.\n\n2. If an environment variable with the same name as one of the categories above exists and is\nnon-null, its value is used for that category.\n\n3. If there is a non-null environment variable LANG, the value of LANG is used.\n\nValues about local numeric formatting is made available in a struct lconv returned by the lo‐‐\ncaleconv(3) function, which has the following declaration:\n\nstruct lconv {\n\n/* Numeric (nonmonetary) information */\n\nchar *decimalpoint;     /* Radix character */\nchar *thousandssep;     /* Separator for digit groups to left\nof radix character */\nchar *grouping;     /* Each element is the number of digits in\na group; elements with higher indices\nare further left.  An element with value\nCHARMAX means that no further grouping\nis done.  An element with value 0 means\nthat the previous element is used for\nall groups further left. */\n\n/* Remaining fields are for monetary information */\n\nchar *intcurrsymbol;   /* First three chars are a currency\nsymbol from ISO 4217.  Fourth char\nis the separator.  Fifth char\nis '\\0'. */\nchar *currencysymbol;   /* Local currency symbol */\nchar *mondecimalpoint; /* Radix character */\nchar *monthousandssep; /* Like thousandssep above */\nchar *mongrouping;      /* Like grouping above */\nchar *positivesign;     /* Sign for positive values */\nchar *negativesign;     /* Sign for negative values */\nchar  intfracdigits;   /* International fractional digits */\nchar  fracdigits;       /* Local fractional digits */\nchar  pcsprecedes;     /* 1 if currencysymbol precedes a\npositive value, 0 if succeeds */\nchar  psepbyspace;    /* 1 if a space separates\ncurrencysymbol from a positive\nvalue */\nchar  ncsprecedes;     /* 1 if currencysymbol precedes a\nnegative value, 0 if succeeds */\nchar  nsepbyspace;    /* 1 if a space separates\ncurrencysymbol from a negative\nvalue */\n/* Positive and negative sign positions:\n0 Parentheses surround the quantity and currencysymbol.\n1 The sign string precedes the quantity and currencysymbol.\n2 The sign string succeeds the quantity and currencysymbol.\n3 The sign string immediately precedes the currencysymbol.\n4 The sign string immediately succeeds the currencysymbol. */\nchar  psignposn;\nchar  nsignposn;\n};\n",
            "subsections": [
                {
                    "name": "POSIX.1-2008 extensions to the locale API",
                    "content": "POSIX.1-2008 standardized a number of extensions to the locale API, based on  implementations\nthat  first  appeared  in version 2.3 of the GNU C library.  These extensions are designed to\naddress the problem that the traditional locale APIs do not mix well with  multithreaded  ap‐\nplications and with applications that must deal with multiple locales.\n\nThe  extensions  take  the form of new functions for creating and manipulating locale objects\n(newlocale(3), freelocale(3), duplocale(3), and uselocale(3)) and various new  library  func‐\ntions  with the suffix \"l\" (e.g., toupperl(3)) that extend the traditional locale-dependent\nAPIs (e.g., toupper(3)) to allow the specification of a locale object that should apply  when\nexecuting the function.\n"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "The following environment variable is used by newlocale(3) and setlocale(3), and thus affects\nall unprivileged localized programs:\n\nLOCPATH\nA list of pathnames, separated by colons (':'), that should be  used  to  find  locale\ndata.   If  this  variable is set, only the individual compiled locale data files from\nLOCPATH and the system default locale data path are used;  any  available  locale  ar‐\nchives are not used (see localedef(1)).  The individual compiled locale data files are\nsearched for under subdirectories which depend on the currently used locale.  For  ex‐\nample,  when  enGB.UTF-8  is  used  for  a category, the following subdirectories are\nsearched for, in this order: enGB.UTF-8, enGB.utf8, enGB,  en.UTF-8,  en.utf8,  and\nen.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/usr/lib/locale/locale-archive\nUsual default locale archive location.\n\n/usr/lib/locale\nUsual default path for compiled individual locale files.\n",
            "subsections": []
        },
        "CONFORMING TO": {
            "content": "POSIX.1-2001.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "iconv(1),  locale(1),  localedef(1),  catopen(3),  gettext(3),  iconv(3),  localeconv(3), mb‐‐\nstowcs(3), newlocale(3), ngettext(3), nllanginfo(3), rpmatch(3),  setlocale(3),  strcoll(3),\nstrfmon(3),  strftime(3), strxfrm(3), uselocale(3), wcstombs(3), locale(5), charsets(7), uni‐‐\ncode(7), utf-8(7)\n",
            "subsections": []
        },
        "COLOPHON": {
            "content": "This page is part of release 5.10 of the Linux  man-pages  project.   A  description  of  the\nproject,  information about reporting bugs, and the latest version of this page, can be found\nat https://www.kernel.org/doc/man-pages/.\n\n\n\nLinux                                        2019-03-06                                    LOCALE(7)",
            "subsections": []
        }
    },
    "summary": "locale - description of multilanguage support",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "iconv",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/iconv/1/json"
        },
        {
            "name": "localedef",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/localedef/1/json"
        },
        {
            "name": "catopen",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/catopen/3/json"
        },
        {
            "name": "gettext",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/gettext/3/json"
        },
        {
            "name": "iconv",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/iconv/3/json"
        },
        {
            "name": "localeconv",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/localeconv/3/json"
        },
        {
            "name": "stowcs",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/stowcs/3/json"
        },
        {
            "name": "newlocale",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/newlocale/3/json"
        },
        {
            "name": "ngettext",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/ngettext/3/json"
        },
        {
            "name": "nllanginfo",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/nllanginfo/3/json"
        },
        {
            "name": "rpmatch",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpmatch/3/json"
        },
        {
            "name": "setlocale",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/setlocale/3/json"
        },
        {
            "name": "strcoll",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/strcoll/3/json"
        },
        {
            "name": "strfmon",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/strfmon/3/json"
        },
        {
            "name": "strftime",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/strftime/3/json"
        },
        {
            "name": "strxfrm",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/strxfrm/3/json"
        },
        {
            "name": "uselocale",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/uselocale/3/json"
        },
        {
            "name": "wcstombs",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/wcstombs/3/json"
        },
        {
            "name": "charsets",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/charsets/7/json"
        },
        {
            "name": "code",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/code/7/json"
        },
        {
            "name": "utf-8",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/utf-8/7/json"
        }
    ]
}