{
    "mode": "man",
    "parameter": "localedef",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/localedef/1/json",
    "generated": "2026-08-12T01:26:18Z",
    "synopsis": "localedef [options] outputpath\nlocaledef --add-to-archive [options] compiledpath\nlocaledef --delete-from-archive [options] localename ...\nlocaledef --list-archive [options]",
    "sections": {
        "NAME": {
            "content": "localedef - compile locale definition files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "localedef [options] outputpath\n\nlocaledef --add-to-archive [options] compiledpath\n\nlocaledef --delete-from-archive [options] localename ...\n\nlocaledef --list-archive [options]\n",
            "subsections": [
                {
                    "name": "localedef --help",
                    "content": ""
                },
                {
                    "name": "localedef --usage",
                    "content": ""
                },
                {
                    "name": "localedef --version",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "The  localedef program reads the indicated charmap and input files, compiles them to a binary\nform quickly usable by the locale functions in the C  library  (setlocale(3),  localeconv(3),\netc.), and places the output in outputpath.\n\nThe outputpath argument is interpreted as follows:\n\n•  If  outputpath  contains a slash character ('/'), it is interpreted as the name of the di‐\nrectory where the output definitions are to be stored.  In this case, there is a  separate\noutput file for each locale category (LCTIME, LCNUMERIC, and so on).\n\n•  If  the  --no-archive  option  is  used,  outputpath  is  the  name  of  a subdirectory in\n/usr/lib/locale where per-category compiled files are placed.\n\n•  Otherwise, outputpath is the name of a locale and the compiled locale data is added to the\narchive file /usr/lib/locale/locale-archive.  A locale archive  is  a  memory-mapped  file\nwhich  contains all the system-provided locales; it is used by all localized programs when\nthe environment variable LOCPATH is not set.\n\nIn any case, localedef aborts if the directory in which it tries to write  locale  files  has\nnot already been created.\n\nIf  no  charmapfile is given, the value ANSIX3.4-1968 (for ASCII) is used by default.  If no\ninputfile is given, or if it is given as a dash (-), localedef reads from standard input.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "Operation-selection options",
                    "content": "A few options direct localedef to do something other than compile locale  definitions.   Only\none of these options should be used at a time.\n"
                },
                {
                    "name": "--add-to-archive",
                    "content": "Add  the  compiledpath directories to the locale archive file.  The directories should\nhave been created by previous runs of localedef, using --no-archive.\n",
                    "long": "--add-to-archive"
                },
                {
                    "name": "--delete-from-archive",
                    "content": "Delete the named locales from the locale archive file.\n",
                    "long": "--delete-from-archive"
                },
                {
                    "name": "--list-archive",
                    "content": "List the locales contained in the locale archive file.\n",
                    "long": "--list-archive"
                },
                {
                    "name": "Other options",
                    "content": "Some of the following options are sensible only for certain operations; generally, it  should\nbe  self-evident  which ones.  Notice that -f and -c are reversed from what you might expect;\nthat is, -f is not the same as --force.\n"
                },
                {
                    "name": "-f _ --charmap=_",
                    "content": "Specify the file that defines the character set that is used by the  input  file.   If\ncharmapfile  contains  a  slash  character ('/'), it is interpreted as the name of the\ncharacter map.  Otherwise, the file is sought in the current directory and the default\ndirectory  for  character  maps.   If  the  environment  variable  I18NPATH  is   set,\n$I18NPATH/charmaps/ and $I18NPATH/ are also searched after the current directory.  The\ndefault directory for character maps is printed by localedef --help.\n",
                    "flag": "-f",
                    "long": "--charmap",
                    "arg": "_"
                },
                {
                    "name": "-i _ --inputfile=_",
                    "content": "Specify  the locale definition file to compile.  The file is sought in the current di‐\nrectory and the default directory for locale definition  files.   If  the  environment\nvariable I18NPATH is set, $I18NPATH/locales/ and $I18NPATH are also searched after the\ncurrent  directory.   The  default directory for locale definition files is printed by\nlocaledef --help.\n",
                    "flag": "-i",
                    "long": "--inputfile",
                    "arg": "_"
                },
                {
                    "name": "-u _ --repertoire-map=_",
                    "content": "Read mappings from symbolic names to Unicode  code  points  from  repertoirefile.   If\nrepertoirefile  contains a slash character ('/'), it is interpreted as the pathname of\nthe repertoire map.  Otherwise, the file is sought in the current  directory  and  the\ndefault  directory  for repertoire maps.  If the environment variable I18NPATH is set,\n$I18NPATH/repertoiremaps/ and $I18NPATH are also searched after the current directory.\nThe default directory for repertoire maps is printed by localedef --help.\n",
                    "flag": "-u",
                    "long": "--repertoire-map",
                    "arg": "_"
                },
                {
                    "name": "-A _ --alias-file=_",
                    "content": "Use aliasfile to look up aliases for locale names.  There is no default aliases file.\n",
                    "flag": "-A",
                    "long": "--alias-file",
                    "arg": "_"
                },
                {
                    "name": "--force",
                    "content": "",
                    "long": "--force"
                },
                {
                    "name": "-c",
                    "content": "",
                    "flag": "-c"
                },
                {
                    "name": "--verbose",
                    "content": "",
                    "long": "--verbose"
                },
                {
                    "name": "-v",
                    "content": "",
                    "flag": "-v"
                },
                {
                    "name": "--big-endian",
                    "content": "Generate big-endian output.\n",
                    "long": "--big-endian"
                },
                {
                    "name": "--little-endian",
                    "content": "Generate little-endian output.\n",
                    "long": "--little-endian"
                },
                {
                    "name": "--no-archive",
                    "content": "Do not use the locale archive file, instead create outputpath as a subdirectory in the\nsame directory as the locale archive file, and create separate output files for locale\ncategories in it.  This is helpful to prevent system locale archive updates from over‐\nwriting custom locales created with localedef.\n",
                    "long": "--no-archive"
                },
                {
                    "name": "--no-hard-links",
                    "content": "Do not create hard links between installed locales.\n\n--no-warnings=warnings\nComma-separated list of  warnings  to  disable.   Supported  warnings  are  ascii  and\nintcurrsym.\n",
                    "long": "--no-hard-links"
                },
                {
                    "name": "--posix",
                    "content": "Conform strictly to POSIX.  Implies --verbose.  This option currently has no other ef‐\nfect.   POSIX  conformance  is  assumed if the environment variable POSIXLYCORRECT is\nset.\n\n--prefix=pathname\nSet the prefix to be prepended to the full archive pathname.  By default,  the  prefix\nis  empty.   Setting the prefix to foo, the archive would be placed in foo/usr/lib/lo‐\ncale/locale-archive.\n",
                    "long": "--posix"
                },
                {
                    "name": "--quiet",
                    "content": "Suppress all notifications and warnings, and report only fatal errors.\n",
                    "long": "--quiet"
                },
                {
                    "name": "--replace",
                    "content": "Replace a locale in the locale archive file.  Without this option, if the locale is in\nthe archive file already, an error occurs.\n\n--warnings=warnings\nComma-separated list  of  warnings  to  enable.   Supported  warnings  are  ascii  and\nintcurrsym.\n",
                    "long": "--replace"
                },
                {
                    "name": "--help",
                    "content": "-?     Print a usage summary and exit.  Also prints the default paths used by localedef.\n",
                    "long": "--help"
                },
                {
                    "name": "--usage",
                    "content": "Print a short usage summary and exit.\n",
                    "long": "--usage"
                },
                {
                    "name": "--version",
                    "content": "",
                    "long": "--version"
                },
                {
                    "name": "-V",
                    "content": "",
                    "flag": "-V"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "One of the following exit values can be returned by localedef:\n\n0      Command completed successfully.\n\n1      Warnings or errors occurred, output files were written.\n\n4      Errors encountered, no output created.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "POSIXLYCORRECT\nThe --posix flag is assumed if this environment variable is set.\n\nI18NPATH\nA colon-separated list of search directories for files.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/usr/share/i18n/charmaps\nUsual default character map path.\n\n/usr/share/i18n/locales\nUsual default path for locale definition files.\n\n/usr/share/i18n/repertoiremaps\nUsual default repertoire map path.\n\n/usr/lib/locale/locale-archive\nUsual default locale archive location.\n\n/usr/lib/locale\nUsual default path for compiled individual locale data files.\n\noutputpath/LCADDRESS\nAn  output file that contains information about formatting of addresses and geography-\nrelated items.\n\noutputpath/LCCOLLATE\nAn output file that contains information about the rules for comparing strings.\n\noutputpath/LCCTYPE\nAn output file that contains information about character classes.\n\noutputpath/LCIDENTIFICATION\nAn output file that contains metadata about the locale.\n\noutputpath/LCMEASUREMENT\nAn output file that contains information about locale measurements (metric  versus  US\ncustomary).\n\noutputpath/LCMESSAGES/SYSLCMESSAGES\nAn output file that contains information about the language messages should be printed\nin, and what an affirmative or negative answer looks like.\n\noutputpath/LCMONETARY\nAn output file that contains information about formatting of monetary values.\n\noutputpath/LCNAME\nAn output file that contains information about salutations for persons.\n\noutputpath/LCNUMERIC\nAn  output file that contains information about formatting of nonmonetary numeric val‐\nues.\n\noutputpath/LCPAPER\nAn output file that contains information about  settings  related  to  standard  paper\nsize.\n\noutputpath/LCTELEPHONE\nAn  output file that contains information about formats to be used with telephone ser‐\nvices.\n\noutputpath/LCTIME\nAn output file that contains information about formatting of data and time values.\n",
            "subsections": []
        },
        "STANDARDS": {
            "content": "POSIX.1-2008.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Compile the locale files for Finnish in the UTF-8 character set and add it to the default lo‐\ncale archive with the name fiFI.UTF-8:\n\nlocaledef -f UTF-8 -i fiFI fiFI.UTF-8\n\nThe next example does the same thing, but generates  files  into  the  fiFI.UTF-8  directory\nwhich  can  then be used by programs when the environment variable LOCPATH is set to the cur‐\nrent directory (note that the last argument must contain a slash):\n\nlocaledef -f UTF-8 -i fiFI ./fiFI.UTF-8\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "locale(1), charmap(5), locale(5), repertoiremap(5), locale(7)\n\nLinux man-pages 6.7                          2023-10-31                                 localedef(1)",
            "subsections": []
        }
    },
    "summary": "localedef - compile locale definition files",
    "flags": [
        {
            "flag": "",
            "long": "--add-to-archive",
            "arg": null,
            "description": "Add the compiledpath directories to the locale archive file. The directories should have been created by previous runs of localedef, using --no-archive."
        },
        {
            "flag": "",
            "long": "--delete-from-archive",
            "arg": null,
            "description": "Delete the named locales from the locale archive file."
        },
        {
            "flag": "",
            "long": "--list-archive",
            "arg": null,
            "description": "List the locales contained in the locale archive file."
        },
        {
            "flag": "-f",
            "long": "--charmap",
            "arg": "_",
            "description": "Specify the file that defines the character set that is used by the input file. If charmapfile contains a slash character ('/'), it is interpreted as the name of the character map. Otherwise, the file is sought in the current directory and the default directory for character maps. If the environment variable I18NPATH is set, $I18NPATH/charmaps/ and $I18NPATH/ are also searched after the current directory. The default directory for character maps is printed by localedef --help."
        },
        {
            "flag": "-i",
            "long": "--inputfile",
            "arg": "_",
            "description": "Specify the locale definition file to compile. The file is sought in the current di‐ rectory and the default directory for locale definition files. If the environment variable I18NPATH is set, $I18NPATH/locales/ and $I18NPATH are also searched after the current directory. The default directory for locale definition files is printed by localedef --help."
        },
        {
            "flag": "-u",
            "long": "--repertoire-map",
            "arg": "_",
            "description": "Read mappings from symbolic names to Unicode code points from repertoirefile. If repertoirefile contains a slash character ('/'), it is interpreted as the pathname of the repertoire map. Otherwise, the file is sought in the current directory and the default directory for repertoire maps. If the environment variable I18NPATH is set, $I18NPATH/repertoiremaps/ and $I18NPATH are also searched after the current directory. The default directory for repertoire maps is printed by localedef --help."
        },
        {
            "flag": "-A",
            "long": "--alias-file",
            "arg": "_",
            "description": "Use aliasfile to look up aliases for locale names. There is no default aliases file."
        },
        {
            "flag": "",
            "long": "--force",
            "arg": null,
            "description": ""
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--verbose",
            "arg": null,
            "description": ""
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": "--big-endian",
            "arg": null,
            "description": "Generate big-endian output."
        },
        {
            "flag": "",
            "long": "--little-endian",
            "arg": null,
            "description": "Generate little-endian output."
        },
        {
            "flag": "",
            "long": "--no-archive",
            "arg": null,
            "description": "Do not use the locale archive file, instead create outputpath as a subdirectory in the same directory as the locale archive file, and create separate output files for locale categories in it. This is helpful to prevent system locale archive updates from over‐ writing custom locales created with localedef."
        },
        {
            "flag": "",
            "long": "--no-hard-links",
            "arg": null,
            "description": "Do not create hard links between installed locales. --no-warnings=warnings Comma-separated list of warnings to disable. Supported warnings are ascii and intcurrsym."
        },
        {
            "flag": "",
            "long": "--posix",
            "arg": null,
            "description": "Conform strictly to POSIX. Implies --verbose. This option currently has no other ef‐ fect. POSIX conformance is assumed if the environment variable POSIXLYCORRECT is set. --prefix=pathname Set the prefix to be prepended to the full archive pathname. By default, the prefix is empty. Setting the prefix to foo, the archive would be placed in foo/usr/lib/lo‐ cale/locale-archive."
        },
        {
            "flag": "",
            "long": "--quiet",
            "arg": null,
            "description": "Suppress all notifications and warnings, and report only fatal errors."
        },
        {
            "flag": "",
            "long": "--replace",
            "arg": null,
            "description": "Replace a locale in the locale archive file. Without this option, if the locale is in the archive file already, an error occurs. --warnings=warnings Comma-separated list of warnings to enable. Supported warnings are ascii and intcurrsym."
        },
        {
            "flag": "",
            "long": "--help",
            "arg": null,
            "description": "-? Print a usage summary and exit. Also prints the default paths used by localedef."
        },
        {
            "flag": "",
            "long": "--usage",
            "arg": null,
            "description": "Print a short usage summary and exit."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": ""
        },
        {
            "flag": "-V",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "examples": [
        "Compile the locale files for Finnish in the UTF-8 character set and add it to the default lo‐",
        "cale archive with the name fiFI.UTF-8:",
        "localedef -f UTF-8 -i fiFI fiFI.UTF-8",
        "The next example does the same thing, but generates  files  into  the  fiFI.UTF-8  directory",
        "which  can  then be used by programs when the environment variable LOCPATH is set to the cur‐",
        "rent directory (note that the last argument must contain a slash):",
        "localedef -f UTF-8 -i fiFI ./fiFI.UTF-8"
    ],
    "see_also": [
        {
            "name": "locale",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/locale/1/json"
        },
        {
            "name": "charmap",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/charmap/5/json"
        },
        {
            "name": "locale",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/locale/5/json"
        },
        {
            "name": "repertoiremap",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/repertoiremap/5/json"
        },
        {
            "name": "locale",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/locale/7/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Manage locale definition files.",
        "examples": [
            {
                "description": "List compiled locales",
                "command": "localedef --list-archive"
            },
            {
                "description": "Display help",
                "command": "localedef {{-?|--help}}"
            }
        ]
    }
}