LOCALEDEF(1P)
๐ธ LOCALEDEF(1P) ๐ธ
okay bestie, welcome to the POSIX Programmer's Manual page for localedef ๐ this is the one that builds whole locales out of source files, and yes it is exactly as powerful as it sounds. grab a snack, we're doing this.
๐ PROLOG ๐
okay so first, the fine print, and it's giving โจlegally requiredโจ:
this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for the deets on Linux behavior, bestie), or the interface may not even be implemented on Linux at all. ๐
๐ NAME ๐
localedef โ define locale environment โจ
๐ฆ SYNOPSIS ๐ฆ
localedef [-c] [-f charmap] [-i sourcefile] [-u code_set_name] name
that's it. that's the whole vibe. ๐ซถ
๐ DESCRIPTION ๐
so the localedef utility shall convert source definitions for locale categories into a format usable by the functions and utilities whose operational behavior is determined by the setting of the locale environment variables defined in the Base Definitions volume of POSIX.1โ2017, Chapter 7, Locale. it's a compiler for locales, basically. iconic behavior.
it is implementation-defined whether users have the capability to create new locales, in addition to those supplied by the implementation. if the symbolic constant POSIX2_LOCALEDEF is defined, the system supports the creation of new locales. on XSI-conformant systems, the symbolic constant POSIX2_LOCALEDEF shall be defined. periodt.
the utility shall read source definitions for one or more locale categories belonging to the same locale from the file named in the -i option (if specified) or from standard input. ๐
the name operand identifies the target locale. the utility shall support the creation of public, or generally accessible locales, as well as private, or restricted-access locales. implementations may restrict the capability to create or modify public locales to users with appropriate privileges. so like, know your permissions, bestie. ๐
each category source definition shall be identified by the corresponding environment variable name and terminated by an END category-name statement. the following categories shall be supported. in addition, the input may contain source for implementation-defined categories. ๐
LC_CTYPEโ defines character classification and case conversion.LC_COLLATEโ defines collation rules.LC_MONETARYโ defines the format and symbols used in formatting of monetary information.LC_NUMERICโ defines the decimal delimiter, grouping, and grouping symbol for non-monetary numeric editing.LC_TIMEโ defines the format and content of date and time information.LC_MESSAGESโ defines the format and values of affirmative and negative responses.
โจ OPTIONS โจ
the localedef utility shall conform to the Base Definitions volume of POSIX.1โ2017, Section 12.2, Utility Syntax Guidelines. yes, the guidelines. we respect the guidelines here. ๐
the following options shall be supported:
-cโ create permanent output even if warning messages have been issued. it's giving "yes i saw the warning and i'm choosing to move anyway." ๐-fcharmap โ specify the pathname of a file containing a mapping of character symbols and collating element symbols to actual character encodings. the format of the charmap is described in the Base Definitions volume of POSIX.1โ2017, Section 6.4, Character Set Description File. the application shall ensure that this option is specified if symbolic names (other than collating symbols defined in acollating-symbolkeyword) are used. if the-foption is not present, an implementation-defined character mapping shall be used. so like, if you're using symbolic names and you didn't pass-f, that's on you fr fr. ๐-iinputfile โ the pathname of a file containing the source definitions. if this option is not present, source definitions shall be read from standard input. the format of the inputfile is described in the Base Definitions volume of POSIX.1โ2017, Section 7.3, Locale Definition. (yes, the synopsis calls itsourcefile, the option description calls it inputfile, we love a little naming chaos ๐ซถ)-ucode_set_name โ specify the name of a codeset used as the target mapping of character symbols and collating element symbols whose encoding values are defined in terms of the ISO/IEC 10646โ1:2000 standard position constant values.
๐ OPERANDS ๐
the following operand shall be supported:
nameโ identifies the locale; see the Base Definitions volume of POSIX.1โ2017, Chapter 7, Locale for a description of the use of this name. if the name contains one or more<slash>characters, name shall be interpreted as a pathname where the created locale definitions shall be stored. if name does not contain any<slash>characters, the interpretation of the name is implementation-defined and the locale shall be public. the ability to create public locales in this way may be restricted to users with appropriate privileges. (as a consequence of specifying one name, although several categories can be processed in one execution, only categories belonging to the same locale can be processed.) like. one name. one locale. that's the rule. ๐
๐ STDIN ๐
unless the -i option is specified, the standard input shall be a text file containing one or more locale category source definitions, as described in the Base Definitions volume of POSIX.1โ2017, Section 7.3, Locale Definition.
and here's the slay part: when lines are continued using the escape character mechanism, there is no limit to the length of the accumulated continued line. go off, king. ๐
๐ INPUT FILES ๐
the character set mapping file specified as the charmap option-argument is described in the Base Definitions volume of POSIX.1โ2017, Section 6.4, Character Set Description File.
if a locale category source definition contains a copy statement, as defined in the Base Definitions volume of POSIX.1โ2017, Chapter 7, Locale, and the copy statement names a valid, existing locale, then localedef shall behave as if the source definition had contained a valid category source definition for the named locale. it's the โจreuseโจ moment. we love efficiency. ๐ซถ
๐ธ ENVIRONMENT VARIABLES ๐ธ
the following environment variables shall affect the execution of localedef:
LANGโ provide a default value for the internationalization variables that are unset or null. (see the Base Definitions volume of POSIX.1โ2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLโ if set to a non-empty string value, override the values of all the other internationalization variables. the main character, lowkey. ๐LC_COLLATEโ (this variable has no affect onlocaledef; the POSIX locale is used for this category.) so like, she's here but she's not doing anything. ๐LC_CTYPEโ determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files). this variable has no affect on the processing oflocaledefinput data; the POSIX locale is used for this purpose, regardless of the value of this variable. ngl, this one surprised me too. ๐LC_MESSAGESโ determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHโ determine the location of message catalogs for the processing ofLC_MESSAGES.
โญ ASYNCHRONOUS EVENTS โญ
Default. that's it. no notes. ๐
๐ฆ STDOUT ๐ฆ
the utility shall report all categories successfully processed, in an unspecified format. so you get the receipts, just not in a specific shape. slay. โจ
๐ STDERR ๐
the standard error shall be used only for diagnostic messages. that's her whole job. respect it.
๐ OUTPUT FILES ๐
the format of the created output is unspecified. and if the name operand does not contain a <slash>, the existence of an output file for the locale is unspecified. so like. it's giving mystery. it's giving we'll see. ๐ซ๏ธ
๐ EXTENDED DESCRIPTION ๐
okay this is the section where it gets a little spicy, so pay attention bestie:
when the -u option is used, the code_set_name option-argument shall be interpreted as an implementation-defined name of a codeset to which the ISO/IEC 10646โ1:2000 standard position constant values shall be converted via an implementation-defined method. both the ISO/IEC 10646โ1:2000 standard position constant values and other formats (decimal, hexadecimal, or octal) shall be valid as encoding values within the charmap file. the codeset represented by the implementation-defined name can be any codeset that is supported by the implementation. ๐
when conflicts occur between the charmap specification of<code_set_name>,<mb_cur_max>, or<mb_cur_min>and the implementation-defined interpretation of these respective items for the codeset represented by the-uoption-argument code_set_name, the result is unspecified. ๐
when conflicts occur between the charmap encoding values specified for symbolic names of characters of the portable character set and the implementation-defined assignment of character encoding values, the result is unspecified. ๐ซ
if a non-printable character in the charmap has a width specified that is not -1, the result will be undefined. do not do this. i'm serious. ๐ญ
โญ EXIT STATUS โญ
the following exit values shall be returned:
0โ no errors occurred and the locales were successfully created. we ate. ๐1โ warnings occurred and the locales were successfully created. close enough bestie. ๐2โ the locale specification exceeded implementation limits or the coded character set or sets used were not supported by the implementation, and no locale was created.3โ the capability to create new locales is not supported by the implementation. ๐>3โ warnings or errors occurred and no output was created.
๐ CONSEQUENCES OF ERRORS ๐
if an error is detected, no permanent output shall be created. periodt.
if warnings occur, permanent output shall be created if the -c option was specified. the following conditions shall cause warning messages to be issued:
- if a symbolic name not found in the charmap file is used for the descriptions of the
LC_CTYPEorLC_COLLATEcategories (for other categories, this shall be an error condition). so like, in those two it's a warning, everywhere else it's a whole problem. ๐จ - if the number of operands to the
orderkeyword exceeds the{COLL_WEIGHTS_MAX}limit. - if optional keywords not supported by the implementation are present in the source.
other implementation-defined conditions may also cause warnings. ๐
the following sections are informative.
๐ APPLICATION USAGE ๐
the charmap definition is optional, and is contained outside the locale definition. this allows both completely self-defined source files, and generic sources (applicable to more than one codeset). to aid portability, all charmap definitions must use the same symbolic names for the portable character set. as explained in the Base Definitions volume of POSIX.1โ2017, Section 6.4, Character Set Description File, it is implementation-defined whether or not users or applications can provide additional character set description files. therefore, the -f option might be operable only when an implementation-defined charmap is named. iykyk. ๐ซถ
๐ EXAMPLES ๐
None. literally none. the page said what it said. ๐ญ
๐ญ RATIONALE
Okay so here's the tea, bestie: the output that localedef produces is implementation-defined. Meaning?? The standard doesn't micromanage what the output looks like โ that's up to whoever implemented it on your system. It's giving "you do you" energy, fr fr. ๐
The name operand is what identifies the specific locale. It's the whole point of the name, she's the main character. ๐
And because of that โ here's the consequence, so listen up โ even though you can process several categories in one execution, you can only process categories that belong to the same locale. No mixing and matching locales in a single run, babes. The name operand is the group chat and everybody in it has to be from the same locale, periodt. ๐
๐ฎ FUTURE DIRECTIONS
None. โจ
That's it. That's the section. The future is a blank canvas, the roadmap is empty, we are simply living in the present. ๐ฆ Nothing planned, nothing coming, no sneaky little "this might change later" notes. It's iconic honestly. Slay. ๐
๐ SEE ALSO
The gang's all here, go read these when you're done with me:
localeโ yes bestie, the matching utility, go say hi ๐ซถ- The Base Definitions volume of POSIX.1โ2017, Section 6.4, Character Set Description File
- The Base Definitions volume of POSIX.1โ2017, Chapter 7, Locale
- The Base Definitions volume of POSIX.1โ2017, Chapter 8, Environment Variables
- The Base Definitions volume of POSIX.1โ2017, Section 12.2, Utility Syntax Guidelines
Like a little reading list for the girlies who want the full lore. ๐โจ
โ๏ธ COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
No cap, if this page and the actual Standard ever disagree, the Standard wins. She's the referee, she makes the calls, we just live here. ๐
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
Found a typo? It's probably from the man page conversion glow-up, not the source material. Tell the kernel doc girlies at the link above and they'll sort it. ๐
That's the whole page, bestie!! ๐ You made it to the end and honestly? Obsessed with you. Go forth and build your locales, the categories are yours, the name operand is chosen, the future directions are literally none. ๐
This lil masterpiece comes courtesy of IEEE/The Open Group, dated 2017, and it lives at LOCALEDEF(1P) โ that's section 1P for the POSIX girlies specifically. ๐ฆโจ
bye bestie, go read locale(1P) next, mwah ๐๐
๐ฆ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 ยท custom
- alpine 3.23: man-pages-posix 2017a-r0 ยท custom
- alpine 3.24: man-pages-posix 2017a-r0 ยท custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 ยท SUSE-IEEE
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms