locale(5)
๐ locale(5) โ File Formats Manual ๐
โจ NAME โจ
locale โ describes a locale definition file. Bestie, it's literally the blueprint for a locale. ๐
๐ธ DESCRIPTION ๐ธ
The locale definition file contains all the information that localedef(1) needs to convert it into the binary locale database. No cap, that's the whole point. โจ
The definition files consist of sections which each describe a locale category in detail. See locale(7) for additional details for these categories. ๐
๐ฆ Syntax ๐ฆ
The locale definition file starts with a header that may consist of the following keywords:
escape_charโ is followed by a character that should be used as the escape-character for the rest of the file to mark characters that should be interpreted in a special way. It defaults to the backslash (\). ๐ชcomment_charโ is followed by a character that will be used as the comment-character for the rest of the file. It defaults to the number sign (#). ๐ฌ
The locale definition has one part for each locale category. Each part can be copied from another existing locale or can be defined from scratch. If the category should be copied, the only valid keyword in the definition is copy followed by the name of the locale in double quotes which should be copied. The exceptions for this rule are LC_COLLATE and LC_CTYPE where a copy statement can be followed by locale-specific rules and selected overrides. ๐ซถ
When defining a locale or a category from scratch, an existing system-provided locale definition file should be used as a reference to follow common glibc conventions. Trust the process. ๐
๐ Locale category sections ๐
The following category sections are defined by POSIX:
LC_CTYPELC_COLLATELC_MESSAGESLC_MONETARYLC_NUMERICLC_TIME
In addition, since glibc 2.2, the GNU C library supports the following nonstandard categories:
LC_ADDRESSLC_IDENTIFICATIONLC_MEASUREMENTLC_NAMELC_PAPERLC_TELEPHONE
See locale(7) for a more detailed description of each category. ๐
๐ LC_ADDRESS ๐
The definition starts with the string LC_ADDRESS in the first column.
The following keywords are allowed:
postal_fmtโ followed by a string containing field descriptors that define the format used for postal addresses in the locale. The following field descriptors are recognized:%nโ Person's name, possibly constructed with theLC_NAMEname_fmtkeyword (since glibc 2.24).%aโ Care of person, or organization.%fโ Firm name.%dโ Department name.%bโ Building name.%sโ Street or block (e.g., Japanese) name.%hโ House number or designation.%Nโ Insert an end-of-line if the previous descriptor's value was not an empty string; otherwise, ignore.%tโ Insert a space if the previous descriptor's value was not an empty string; otherwise, ignore.%rโ Room number, door designation.%eโ Floor number.%Cโ Country designation, from thecountry_postkeyword.%lโ Local township within town or city (since glibc 2.24).%zโ Zip number, postal code.%Tโ Town, city.%Sโ State, province, or prefecture.%cโ Country, as taken from data record.
Each field descriptor may have an 'R' after the '%' to specify that the information is taken from a Romanized version string of the entity. ๐บ๏ธ
country_nameโ followed by the country name in the language of the current document (e.g.,"Deutschland"for thede_DElocale).country_postโ followed by the abbreviation of the country (for example,CEPT-MAILCODEcodes).country_ab2โ followed by the two-letter abbreviation of the country (ISO 3166).country_ab3โ followed by the three-letter abbreviation of the country (ISO 3166).country_numโ followed by the numeric country code (ISO 3166).country_carโ followed by the international license plate country code.country_isbnโ followed by the ISBN code (for books).lang_nameโ followed by the language name in the language of the current document.lang_abโ followed by the two-letter abbreviation of the language (ISO 639).lang_termโ followed by the three-letter abbreviation of the language (ISO 639-2/T).lang_libโ followed by the three-letter abbreviation of the language for library use (ISO 639-2/B). Applications should in general preferlang_termoverlang_lib.
The LC_ADDRESS definition ends with the string END LC_ADDRESS. โ
๐ LC_CTYPE ๐
The definition starts with the string LC_CTYPE in the first column.
The following keywords are allowed:
upperโ followed by a list of uppercase letters. The lettersAthroughZare included automatically. Characters also specified ascntrl,digit,punct, orspaceare not allowed.lowerโ followed by a list of lowercase letters. The lettersathroughzare included automatically. Characters also specified ascntrl,digit,punct, orspaceare not allowed.alphaโ followed by a list of letters. All characters specified as eitherupperorlowerare automatically included. Characters also specified ascntrl,digit,punct, orspaceare not allowed.digitโ followed by the characters classified as numeric digits. Only the digits0through9are allowed. They are included by default in this class.spaceโ followed by a list of characters defined as white-space characters. Characters also specified asupper,lower,alpha,digit,graph, orxdigitare not allowed. The characters<space>,<form-feed>,<newline>,<carriage-return>,<tab>, and<vertical-tab>are automatically included.cntrlโ followed by a list of control characters. Characters also specified asupper,lower,alpha,digit,punct,graph,print, orxdigitare not allowed.punctโ followed by a list of punctuation characters. Characters also specified asupper,lower,alpha,digit,cntrl,xdigit, or the<space>character are not allowed.graphโ followed by a list of printable characters, not including the<space>character. The characters defined asupper,lower,alpha,digit,xdigit, andpunctare automatically included. Characters also specified ascntrlare not allowed.printโ followed by a list of printable characters, including the<space>character. The characters defined asupper,lower,alpha,digit,xdigit,punct, and the<space>character are automatically included. Characters also specified ascntrlare not allowed.xdigitโ followed by a list of characters classified as hexadecimal digits. The decimal digits must be included followed by one or more set of six characters in ascending order. The following characters are included by default:0through9,athroughf,AthroughF.blankโ followed by a list of characters classified as blank. The characters<space>and<tab>are automatically included.charclassโ followed by a list of locale-specific character class names which are then to be defined in the locale.toupperโ followed by a list of mappings from lowercase to uppercase letters. Each mapping is a pair of a lowercase and an uppercase letter separated with a,and enclosed in parentheses.tolowerโ followed by a list of mappings from uppercase to lowercase letters. If the keywordtoloweris not present, the reverse of thetoupperlist is used.map totitleโ followed by a list of mapping pairs of characters and letters to be used in titles (headings).classโ followed by a locale-specific character class definition, starting with the class name followed by the characters belonging to the class.charconvโ followed by a list of locale-specific character mapping names which are then to be defined in the locale.outdigitโ followed by a list of alternate output digits for the locale.map to_inpunctโ followed by a list of mapping pairs of alternate digits and separators for input digits for the locale.map to_outpunctโ followed by a list of mapping pairs of alternate separators for output for the locale.translit_startโ marks the start of the transliteration rules section. The section can contain theincludekeyword in the beginning followed by locale-specific rules and overrides. Any rule specified in the locale file will override any rule copied or included from other files. In case of duplicate rule definitions in the locale file, only the first rule is used.
A transliteration rule consist of a character to be transliterated followed by a list of transliteration targets separated by semicolons. The first target which can be presented in the target character set is used, if none of them can be used the default_missing character will be used instead. ๐ฅ
includeโ in the transliteration rules section includes a transliteration rule file (and optionally a repertoire map file).default_missingโ in the transliteration rules section defines the default character to be used for transliteration where none of the targets cannot be presented in the target character set.translit_endโ marks the end of the transliteration rules.
The LC_CTYPE definition ends with the string END LC_CTYPE. ๐
๐ LC_COLLATE ๐
Note that glibc does not support all POSIX-defined options, only the options described below are supported (as of glibc 2.23). Periodt. ๐
The definition starts with the string LC_COLLATE in the first column.
The following keywords are allowed:
coll_weight_maxโ followed by the number representing used collation levels. This keyword is recognized but ignored by glibc.collating-elementโ followed by the definition of a collating-element symbol representing a multicharacter collating element.collating-symbolโ followed by the definition of a collating symbol that can be used in collation order statements.defineโ followed by string to be evaluated in anifdefstring /else/endifconstruct.reorder-afterโ followed by a redefinition of a collation rule.reorder-endโ this one marks the end of the redefinition of a collation rule. bye bestie ๐reorder-sections-afterโ followed by a script name, and it reorders the listed scripts after that one.reorder-sections-endโ marks the end of the reordering of sections. closure โจscriptโ followed by a declaration of a script.symbol-equivalenceโ followed by a collating-symbol that's gonna be equivalent to another defined collating-symbol.
The collation rule definition starts with a line:
order_startโ followed by a list of keywords chosen fromforward,backward, orposition. The order definition is made of lines that describe the collation order, and it's terminated with the keywordorder_end.
And the LC_COLLATE definition ends with the string END LC_COLLATE.
๐ LC_IDENTIFICATION ๐
The definition starts with the string LC_IDENTIFICATION in the first column.
The following keywords are allowed:
titleโ followed by the title of the locale document (e.g.,"Maori language locale for New Zealand").sourceโ followed by the name of the organization that maintains this document.addressโ followed by the address of the organization that maintains this document.contactโ followed by the name of the contact person at the organization that maintains this document.emailโ followed by the email address of the person or organization that maintains this document.telโ followed by the telephone number (in international format) of the organization that maintains this document. As of glibc 2.24, this keyword is deprecated in favor of other contact methods. ๐ซfaxโ followed by the fax number (in international format) of the organization that maintains this document. As of glibc 2.24, this keyword is deprecated in favor of other contact methods too. (fax?? in this economy??) ๐languageโ followed by the name of the language to which this document applies.territoryโ followed by the name of the country/geographic extent to which this document applies.audienceโ followed by a description of the audience for which this document is intended.applicationโ followed by a description of any special application for which this document is intended.abbreviationโ followed by the short name for provider of the source of this document.revisionโ followed by the revision number of this document.dateโ followed by the revision date of this document.
Plus, for each of the categories defined by the document, there should be a line starting with the keyword category, followed by:
- a string that identifies this locale category definition,
- a semicolon, and
- one of the
LC_*identifiers.
And the LC_IDENTIFICATION definition ends with the string END LC_IDENTIFICATION.
๐ฌ LC_MESSAGES ๐ฌ
The definition starts with the string LC_MESSAGES in the first column.
The following keywords are allowed:
yesexprโ followed by a regular expression that describes possible yes-responses. (basically the "yeah bestie" detector โจ)noexprโ followed by a regular expression that describes possible no-responses. (the "no thanks" detector ๐)yesstrโ followed by the output string corresponding to"yes".nostrโ followed by the output string corresponding to"no".
And the LC_MESSAGES definition ends with the string END LC_MESSAGES.
๐ LC_MEASUREMENT ๐
The definition starts with the string LC_MEASUREMENT in the first column.
The following keywords are allowed:
measurementโ followed by a number identifying the standard used for measurement. These values are recognized:1โ Metric. ๐2โ US customary measurements. ๐ฆ
And the LC_MEASUREMENT definition ends with the string END LC_MEASUREMENT.
๐ธ LC_MONETARY ๐ธ
The definition starts with the string LC_MONETARY in the first column.
The following keywords are allowed:
int_curr_symbolโ followed by the international currency symbol. This has to be a _4-character string_ containing the international currency symbol as defined by the ISO 4217 standard (three characters) followed by a separator.currency_symbolโ followed by the local currency symbol.mon_decimal_pointโ followed by the single-character string that will be used as the decimal delimiter when formatting monetary quantities.mon_thousands_sepโ followed by the single-character string that will be used as a group separator when formatting monetary quantities.mon_groupingโ followed by a sequence of integers separated by semicolons that describe the formatting of monetary quantities. See grouping below for details. ๐positive_signโ followed by a string that's used to indicate a positive sign for monetary quantities.negative_signโ followed by a string that's used to indicate a negative sign for monetary quantities.int_frac_digitsโ followed by the number of fractional digits that should be used when formatting with theint_curr_symbol.frac_digitsโ followed by the number of fractional digits that should be used when formatting with thecurrency_symbol.p_cs_precedesโ followed by an integer that indicates the placement ofcurrency_symbolfor a nonnegative formatted monetary quantity:0โ the symbol succeeds the value.1โ the symbol precedes the value.
p_sep_by_spaceโ followed by an integer that indicates the separation ofcurrency_symbol, the sign string, and the value for a nonnegative formatted monetary quantity. These values are recognized:0โ No space separates the currency symbol and the value.1โ If the currency symbol and the sign string are adjacent, a space separates them from the value; otherwise a space separates the currency symbol and the value.2โ If the currency symbol and the sign string are adjacent, a space separates them from the value; otherwise a space separates the sign string and the value.
n_cs_precedesโ followed by an integer that indicates the placement ofcurrency_symbolfor a negative formatted monetary quantity. The same values are recognized as forp_cs_precedes.n_sep_by_spaceโ followed by an integer that indicates the separation ofcurrency_symbol, the sign string, and the value for a negative formatted monetary quantity. The same values are recognized as forp_sep_by_space.p_sign_posnโ followed by an integer that indicates where thepositive_signshould be placed for a nonnegative monetary quantity:0โ Parentheses enclose the quantity and thecurrency_symbolorint_curr_symbol.1โ The sign string precedes the quantity and thecurrency_symbolor theint_curr_symbol.2โ The sign string succeeds the quantity and thecurrency_symbolor theint_curr_symbol.3โ The sign string precedes thecurrency_symbolor theint_curr_symbol.4โ The sign string succeeds thecurrency_symbolor theint_curr_symbol.
n_sign_posnโ followed by an integer that indicates where thenegative_signshould be placed for a negative monetary quantity. The same values are recognized as forp_sign_posn.int_p_cs_precedesโ followed by an integer that indicates the placement ofint_curr_symbolfor a nonnegative internationally formatted monetary quantity. The same values are recognized as forp_cs_precedes.int_n_cs_precedesโ followed by an integer that indicates the placement ofint_curr_symbolfor a negative internationally formatted monetary quantity. The same values are recognized as forp_cs_precedes.int_p_sep_by_spaceโ followed by an integer that indicates the separation ofint_curr_symbol, the sign string, and the value for a nonnegative internationally formatted monetary quantity. The same values are recognized as forp_sep_by_space.int_n_sep_by_spaceโ followed by an integer that indicates the separation ofint_curr_symbol, the sign string, and the value for a negative internationally formatted monetary quantity. The same values are recognized as forp_sep_by_space.int_p_sign_posnโ followed by an integer that indicates where thepositive_signshould be placed for a nonnegative internationally formatted monetary quantity. The same values are recognized as forp_sign_posn.int_n_sign_posnโ followed by an integer that indicates where thenegative_signshould be placed for a negative internationally formatted monetary quantity. The same values are recognized as forp_sign_posn.
And the LC_MONETARY definition ends with the string END LC_MONETARY.
ok that was a LOT of money words. hydrate. ๐ง but we ate, no crumbs.
๐ LC_NAME ๐
The definition starts with the string LC_NAME in the first column.
Various keywords are allowed, but only name_fmt is mandatory. The other keywords are only needed if there's a common convention to use the corresponding salutation in this locale. The allowed keywords are as follows:
name_fmtโ followed by a string containing field descriptors that define the format used for names in the locale. These field descriptors are recognized:%fโ Family name(s).%Fโ Family names in uppercase.%gโ First given name.%Gโ First given initial.%lโ First given name with Latin letters.%oโ Other shorter name.%mโ Additional given name(s).%Mโ Initials for additional given name(s).%pโ Profession.%sโ Salutation, such as"Doctor".%Sโ Abbreviated salutation, such as"Mr."or"Dr.".%dโ Salutation, using the FDCC-sets conventions.%tโ If the preceding field descriptor resulted in an empty string, then the empty string, otherwise a space character.
name_genโ followed by the general salutation for any gender. ๐name_mrโ followed by the salutation for men.name_mrsโ followed by the salutation for married women.name_missโ followed by the salutation for unmarried women.name_msโ followed by the salutation valid for all women. ๐
And the LC_NAME definition ends with the string END LC_NAME.
๐ข LC_NUMERIC ๐ข
The definition starts with the string LC_NUMERIC in the first column.
The following keywords are allowed:
decimal_pointโ then the single-character string that's the decimal delimiter when you're formatting numbers. It's giving "the dot" but make it โจlocale-flavoredโจ.thousands_sepโ then the single-character string that's the group separator when formatting numbers. The comma, the space, whatever your locale's serving ๐ .groupingโ then a sequence of integers separated by semicolons that describe how numeric quantities get grouped together.
Each integer = the number of digits in a group. The first integer sets the size of the group sitting immediately to the left of the decimal delimiter. The integers after that define the groups marching leftward from the previous group. If the last integer is not -1, then the size of the previous group (if there even is one) just keeps getting reused for whatever digits are left. If the last integer is -1, then no more grouping happens, periodt.
The LC_NUMERIC definition wraps up with the string END LC_NUMERIC.
LC_PAPER ๐
The definition kicks off with the string LC_PAPER in the first column.
These keywords are allowed:
heightโ then the height, in millimeters, of the standard paper format.widthโ then the width, in millimeters, of the standard paper format.
And the LC_PAPER definition closes out with the string END LC_PAPER.
LC_TELEPHONE โ๏ธ
The definition starts with the string LC_TELEPHONE in the first column.
Here's what's allowed:
tel_int_fmtโ then a string holding field descriptors that say what format you use to dial international numbers. These field descriptors are the ones that get recognized:%aโ Area code without the nationwide prefix (that prefix is often"00").%Aโ Area code including the nationwide prefix.%lโ Local number (within the area code).%eโ Extension (to the local number).%cโ Country code.%Cโ Alternate carrier service code used for dialing abroad.%tโ If the preceding field descriptor produced an empty string, then the empty string; otherwise, a space character.
tel_dom_fmtโ then a string holding field descriptors that say what format you use to dial domestic numbers. The recognized field descriptors are exactly the same ones as fortel_int_fmt.int_selectโ then the prefix you use to call international phone numbers.int_prefixโ then the prefix that other countries use to dial into this one.
The LC_TELEPHONE definition ends with the string END LC_TELEPHONE.
LC_TIME โฐ
The definition starts with the string LC_TIME in the first column.
The following keywords are allowed:
abdayโ then a list of abbreviated names of the days of the week. The list begins with the first day of the week as specified byweek(Sunday by default). Peep NOTES.dayโ then a list of names of the days of the week. The list begins with the first day of the week as specified byweek(Sunday by default). Peep NOTES.abmonโ then a list of abbreviated month names.monโ then a list of month names.d_t_fmtโ then the appropriate date and time format (for syntax, go look atstrftime(3)).d_fmtโ then the appropriate date format (for syntax,strftime(3)).t_fmtโ then the appropriate time format (for syntax,strftime(3)).am_pmโ then the appropriate representation of the am and pm strings. Leave this empty for locales that don't do the whole AM/PM thing.t_fmt_ampmโ then the appropriate time format (for syntax,strftime(3)) when you're on a 12h clock. Leave this empty for locales not using the AM/PM convention.eraโ then semicolon-separated strings that define how years get counted and displayed for each era in the locale. Each string looks like this:
direction:offset:start_date:end_date:era_name:era_format
The fields go like this:
directionโ Either+or-.+means the years closer to start_date have lower numbers than years closer to end_date.-means the opposite, bestie.offsetโ The number of the year closest to start_date in the era, corresponding to the%Eydescriptor (peepstrptime(3)).start_dateโ The start of the era in the formyyyy/mm/dd. Years prior to AD 1 are represented as negative numbers.end_dateโ The end of the era in the formyyyy/mm/dd, or one of the two special values-*or+*.-*means the ending date is the beginning of time.+*means the ending date is the end of time. (Yes, really, packing infinity into two characters, slay.)era_nameโ The name of the era corresponding to the%ECdescriptor (seestrptime(3)).era_formatโ The format of the year in the era, corresponding to the%EYdescriptor (seestrptime(3)).
era_d_fmtโ then the format of the date in alternative era notation, corresponding to the%Exdescriptor (seestrptime(3)).era_t_fmtโ then the format of the time in alternative era notation, corresponding to the%EXdescriptor (seestrptime(3)).era_d_t_fmtโ then the format of the date and time in alternative era notation, corresponding to the%Ecdescriptor (seestrptime(3)).alt_digitsโ then the alternative digits used for date and time in the locale.weekโ then a list of three values separated by semicolons: the number of days in a week (7 by default), a date for the beginning of the week (by default that's the one corresponding to Sunday), and the minimal length of the first week in the year (4 by default). About the start of the week:19971130shall be used for Sunday and19971201shall be used for Monday. Peep NOTES.first_weekday(since glibc 2.2) โ then the number of the day from the day list that should show up as the first day of the week in calendar apps. The default value1corresponds to either Sunday or Monday, depending on what that secondweeklist item says. Peep NOTES.first_workday(since glibc 2.2) โ then the number of the first working day from the day list. The default value is2. Peep NOTES.cal_directionโ then a number value that tells you which direction calendar dates should be displayed in, like so:1โ Left-right from top.2โ Top-down from left.3โ Right-left from top.
date_fmtโ then the appropriate date representation fordate(1)(for syntax, seestrftime(3)).
The LC_TIME definition ends with the string END LC_TIME.
๐ FILES ๐
/usr/lib/locale/locale-archiveโ the usual default locale archive location./usr/share/i18n/localesโ the usual default path for locale definition files.
๐ STANDARDS ๐
POSIX.2.
๐ง NOTES ๐ง
The collective GNU C library community wisdom, regarding abday, day, week, first_weekday, and first_workday, says the following over at https://sourceware.org/glibc/wiki/Locales:
- The value of the second
weeklist item specifies the base of theabdayanddaylists. first_weekdayspecifies the offset of the first day-of-week in theabdayanddaylists.- For compatibility reasons, all glibc locales should set the value of the second
weeklist item to19971130(Sunday) and base theabdayanddaylists appropriately, and setfirst_weekdayandfirst_workdayto1or2, depending on whether the week and work week actually starts on Sunday or Monday for that locale. Compatibility really said "everyone hold hands" ๐ค.
๐ SEE ALSO ๐
iconv(1), locale(1), localedef(1), localeconv(3), newlocale(3), setlocale(3), strftime(3), strptime(3), uselocale(3), charmap(5), charsets(7), locale(7), unicode(7), utf-8(7)
And that's a wrap on locale(5), bestie ๐ This lil masterpiece is from Linux man-pages 6.20, dated 2026-02-08 โ go hydrate and go set your locale correctly, mwah ๐ซถ
๐ฆ where this page comes from
- 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 6.20
- ๐ the page's license: GPL-2.0-or-later
- Copyright 1994, Jochen Hein <jochen.hein@delphi.central.de>
- Copyright 2008, Petr Baudis <pasky@ucw.cz>
- Copyright 2014, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms