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." ๐Ÿ˜Œ
  • -f charmap โ€” 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 a collating-symbol keyword) are used. if the -f option 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. ๐Ÿ™ˆ
  • -i inputfile โ€” 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 it sourcefile, the option description calls it inputfile, we love a little naming chaos ๐Ÿซถ)
  • -u code_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 on localedef; 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 of localedef input 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 of LC_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 -u option-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:

  1. 0 โ€” no errors occurred and the locales were successfully created. we ate. ๐ŸŽ‰
  2. 1 โ€” warnings occurred and the locales were successfully created. close enough bestie. ๐Ÿ˜Œ
  3. 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.
  4. 3 โ€” the capability to create new locales is not supported by the implementation. ๐Ÿ’€
  5. >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_CTYPE or LC_COLLATE categories (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 order keyword 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. ๐Ÿ“šโœจ


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