info > LOCALE(5)

📄 locale(1) - Get Locale-Specific Information

📝 NAME

locale - get locale-specific information

🚀 Quick Reference

Use CaseCommandDescription
View current locale settingslocaleDisplay all current locale category values
List all available localeslocale -aShow all installed locales on the system
List available charmapslocale -mDisplay available character mapping files
Get specific keyword valuelocale date_fmtShow value of a locale keyword (e.g., date format)
Get keyword with namelocale -k date_fmtDisplay keyword name and value
Get category with keyword nameslocale -ck LC_TIMEShow category name and all keyword values
Verbose locale listinglocale -v -aInclude LC_IDENTIFICATION metadata

🔧 SYNOPSIS

locale [option]
locale [option] -a
locale [option] -m
locale [option] name...

📖 DESCRIPTION

The locale command displays information about the current locale, or all locales, on standard output.

When invoked without arguments, locale displays the current locale settings for each locale category (see locale(5)), based on the settings of the environment variables that control the locale (see locale(7)). Values for variables set in the environment are printed without double quotes, implied values are printed with double quotes.

If either the -a or the -m option (or one of their long-format equivalents) is specified, the behavior is as follows:

The locale command can also be provided with one or more arguments, which are the names of locale keywords (for example, date_fmt, ctype-class-names, yesexpr, or decimal_point) or locale categories (for example, LC_CTYPE or LC_TIME). For each argument, the following is displayed:

📌 Options for Arguments

🔧 Other Options

📁 FILES

✅ CONFORMING TO

POSIX.1-2001, POSIX.1-2008.

📋 EXAMPLES

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ locale date_fmt
%a %b %e %H:%M:%S %Z %Y
$ locale -k date_fmt
date_fmt="%a %b %e %H:%M:%S %Z %Y"
$ locale -ck date_fmt
LC_TIME
date_fmt="%a %b %e %H:%M:%S %Z %Y"
$ locale LC_TELEPHONE
+%c (%a) %l
(%a) %l
11
1
UTF-8
$ locale -k LC_TELEPHONE
tel_int_fmt="+%c (%a) %l"
tel_dom_fmt="(%a) %l"
int_select="11"
int_prefix="1"
telephone-codeset="UTF-8"
$ mkdir -p $HOME/.locale
$ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8
$ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date
$ echo "export LOCPATH=\$HOME/.locale" >> $HOME/.bashrc
$ echo "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc

👀 SEE ALSO

localedef(1), charmap(5), locale(5), locale(7)


📄 locale(3perl) - Perl Pragm... to Use or Avoid POSIX Locales

📝 NAME

locale - Perl pragma to use or avoid POSIX locales for built-in operations

⚠️ WARNING

DO NOT USE this pragma in scripts that have multiple threads active. The locale is not local to a single thread. Another thread may change the locale at any time, which could cause at a minimum that a given thread is operating in a locale it isn't expecting to be in. On some platforms, segfaults can also occur. The locale change need not be explicit; some operations cause perl to change the locale itself. You are vulnerable simply by having done a use locale.

🔧 SYNOPSIS

@x = sort @y;      # Native-platform/Unicode code point sort order
{
    use locale;
    @x = sort @y;  # Locale-defined sort order
}
@x = sort @y;      # Native-platform/Unicode code point sort order
                   # again

📖 DESCRIPTION

This pragma tells the compiler to enable (or disable) the use of POSIX locales for built-in operations (for example, LC_CTYPE for regular expressions, LC_COLLATE for string comparison, and LC_NUMERIC for number formatting). Each use locale or no locale affects statements to the end of the enclosing BLOCK.

See perllocale for more detailed information on how Perl supports locales.

On systems that don't have locales, this pragma will cause your operations to behave as if in the C locale; attempts to change the locale will fail.


📄 locale(5) - Describes a Locale Definition File

📝 NAME

locale - describes a locale definition file

📖 DESCRIPTION

The locale definition file contains all the information that the localedef(1) command needs to convert it into the binary locale database.

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:

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.

📂 Locale Category Sections

The following category sections are defined by POSIX:

In addition, since version 2.2, the GNU C library supports the following nonstandard categories:

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.

Allowed keywords: postal_fmt, country_name, country_post, country_ab2, country_ab3, country_num, country_car, country_isbn, lang_name, lang_ab, lang_term, lang_lib.

The definition ends with END LC_ADDRESS.

🔤 LC_CTYPE

Allowed keywords: upper, lower, alpha, digit, space, cntrl, punct, graph, print, xdigit, blank, charclass, toupper, tolower, map totitle, class, charconv, outdigit, map to_inpunct, map to_outpunct, translit_start, include, default_missing, translit_end.

The definition ends with END LC_CTYPE.

📊 LC_COLLATE

Allowed keywords: coll_weight_max, collating-element, collating-symbol, define, reorder-after, reorder-end, reorder-sections-after, reorder-sections-end, script, symbol-equivalence, order_start (with forward, backward, position), order_end.

The definition ends with END LC_COLLATE.

🆔 LC_IDENTIFICATION

Allowed keywords: title, source, address, contact, email, tel, fax, language, territory, audience, application, abbreviation, revision, date, category.

The definition ends with END LC_IDENTIFICATION.

💬 LC_MESSAGES

Allowed keywords: yesexpr, noexpr, yesstr, nostr.

The definition ends with END LC_MESSAGES.

📏 LC_MEASUREMENT

Allowed keyword: measurement (1 = Metric, 2 = US customary).

The definition ends with END LC_MEASUREMENT.

💰 LC_MONETARY

Allowed keywords: int_curr_symbol, currency_symbol, mon_decimal_point, mon_thousands_sep, mon_grouping, positive_sign, negative_sign, int_frac_digits, frac_digits, p_cs_precedes, p_sep_by_space, n_cs_precedes, n_sep_by_space, p_sign_posn, n_sign_posn, int_p_cs_precedes, int_n_cs_precedes, int_p_sep_by_space, int_n_sep_by_space, int_p_sign_posn, int_n_sign_posn.

The definition ends with END LC_MONETARY.

👤 LC_NAME

Mandatory keyword: name_fmt. Other optional keywords: name_gen, name_mr, name_mrs, name_miss, name_ms.

The definition ends with END LC_NAME.

🔢 LC_NUMERIC

Allowed keywords: decimal_point, thousands_sep, grouping.

The definition ends with END LC_NUMERIC.

📄 LC_PAPER

Allowed keywords: height, width.

The definition ends with END LC_PAPER.

📞 LC_TELEPHONE

Allowed keywords: tel_int_fmt, tel_dom_fmt, int_select, int_prefix.

The definition ends with END LC_TELEPHONE.

⏰ LC_TIME

Allowed keywords: abday, day, abmon, mon, d_t_fmt, d_fmt, t_fmt, am_pm, t_fmt_ampm, era, era_d_fmt, era_t_fmt, era_d_t_fmt, alt_digits, week, first_weekday, first_workday, cal_direction, date_fmt.

The definition ends with END LC_TIME.

📁 FILES

✅ CONFORMING TO

POSIX.2.

📝 NOTES

The collective GNU C library community wisdom regarding abday, day, week, first_weekday, and first_workday states at https://sourceware.org/glibc/wiki/Locales the following:

👀 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)


📄 locale(7) - Description of Multilanguage Support

📝 NAME

locale - description of multilanguage support

🔧 SYNOPSIS

#include <locale.h>

📖 DESCRIPTION

A locale is a set of language and cultural rules. These cover aspects such as language for messages, different character sets, lexicographic conventions, and so on. A program needs to be able to determine its locale and act accordingly to be portable to different cultures.

The header <locale.h> declares data types, functions and macros which are useful in this task.

The functions it declares are setlocale(3) to set the current locale, and localeconv(3) to get information about number formatting.

There are different categories for locale information a program might need; they are declared as macros. Using them as the first argument to the setlocale(3) function, it is possible to set one of these to the desired locale:

If the second argument to setlocale(3) is an empty string, "", for the default locale, it is determined using the following steps:

  1. If there is a non-null environment variable LC_ALL, the value of LC_ALL is used.
  2. If an environment variable with the same name as one of the categories above exists and is non-null, its value is used for that category.
  3. If there is a non-null environment variable LANG, the value of LANG is used.

Values about local numeric formatting is made available in a struct lconv returned by the localeconv(3) function, which has the following declaration:

struct lconv {

    /* Numeric (nonmonetary) information */

    char *decimal_point;     /* Radix character */
    char *thousands_sep;     /* Separator for digit groups to left
                                of radix character */
    char *grouping;     /* Each element is the number of digits in
                           a group; elements with higher indices
                           are further left.  An element with value
                           CHAR_MAX means that no further grouping
                           is done.  An element with value 0 means
                           that the previous element is used for
                           all groups further left. */

    /* Remaining fields are for monetary information */

    char *int_curr_symbol;   /* First three chars are a currency
                                symbol from ISO 4217.  Fourth char
                                is the separator.  Fifth char
                                is '\0'. */
    char *currency_symbol;   /* Local currency symbol */
    char *mon_decimal_point; /* Radix character */
    char *mon_thousands_sep; /* Like thousands_sep above */
    char *mon_grouping;      /* Like grouping above */
    char *positive_sign;     /* Sign for positive values */
    char *negative_sign;     /* Sign for negative values */
    char  int_frac_digits;   /* International fractional digits */
    char  frac_digits;       /* Local fractional digits */
    char  p_cs_precedes;     /* 1 if currency_symbol precedes a
                                positive value, 0 if succeeds */
    char  p_sep_by_space;    /* 1 if a space separates
                                currency_symbol from a positive
                                value */
    char  n_cs_precedes;     /* 1 if currency_symbol precedes a
                                negative value, 0 if succeeds */
    char  n_sep_by_space;    /* 1 if a space separates
                                currency_symbol from a negative
                                value */
    /* Positive and negative sign positions:
       0 Parentheses surround the quantity and currency_symbol.
       1 The sign string precedes the quantity and currency_symbol.
       2 The sign string succeeds the quantity and currency_symbol.
       3 The sign string immediately precedes the currency_symbol.
       4 The sign string immediately succeeds the currency_symbol. */
    char  p_sign_posn;
    char  n_sign_posn;
};

🧩 POSIX.1-2008 Extensions to the Locale API

POSIX.1-2008 standardized a number of extensions to the locale API, based on implementations that first appeared in version 2.3 of the GNU C library. These extensions are designed to address the problem that the traditional locale APIs do not mix well with multithreaded applications and with applications that must deal with multiple locales.

The extensions take the form of new functions for creating and manipulating locale objects (newlocale(3), freelocale(3), duplocale(3), and uselocale(3)) and various new library functions with the suffix "_l" (e.g., toupper_l(3)) that extend the traditional locale-dependent APIs (e.g., toupper(3)) to allow the specification of a locale object that should apply when executing the function.

🌍 ENVIRONMENT

The following environment variable is used by newlocale(3) and setlocale(3), and thus affects all unprivileged localized programs:

📁 FILES

✅ CONFORMING TO

POSIX.1-2001.

👀 SEE ALSO

iconv(1), locale(1), localedef(1), catopen(3), gettext(3), iconv(3), localeconv(3), mbstowcs(3), newlocale(3), ngettext(3), nl_langinfo(3), rpmatch(3), setlocale(3), strcoll(3), strfmon(3), strftime(3), strxfrm(3), uselocale(3), wcstombs(3), locale(5), charsets(7), unicode(7), utf-8(7)

LOCALE(5)
📄 locale(1) - Get Locale-Specific Information 📝 NAME 🚀 Quick Reference 🔧 SYNOPSIS 📖 DESCRIPTION
📌 Options for Arguments 🔧 Other Options
📁 FILES ✅ CONFORMING TO 📋 EXAMPLES 👀 SEE ALSO 📄 locale(3perl) - Perl Pragm... to Use or Avoid POSIX Locales 📝 NAME ⚠️ WARNING 🔧 SYNOPSIS 📖 DESCRIPTION 📄 locale(5) - Describes a Locale Definition File 📝 NAME 📖 DESCRIPTION
📝 Syntax 📂 Locale Category Sections 📬 LC_ADDRESS 🔤 LC_CTYPE 📊 LC_COLLATE 🆔 LC_IDENTIFICATION 💬 LC_MESSAGES 📏 LC_MEASUREMENT 💰 LC_MONETARY 👤 LC_NAME 🔢 LC_NUMERIC 📄 LC_PAPER 📞 LC_TELEPHONE ⏰ LC_TIME
📁 FILES ✅ CONFORMING TO 📝 NOTES 👀 SEE ALSO 📄 locale(7) - Description of Multilanguage Support 📝 NAME 🔧 SYNOPSIS 📖 DESCRIPTION
🧩 POSIX.1-2008 Extensions to the Locale API
🌍 ENVIRONMENT 📁 FILES ✅ CONFORMING TO 👀 SEE ALSO

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-03 16:07 @216.73.216.5
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^