locale

Get locale‑specific information.

These variables are used by some utilites to provide different date formats, paper sizes, sort order ….
pubs.openGroup.org/onlinePubs/9699919799/

 > set |grep LC
LC_ALL=C
 > date
Wed Jun 22 13:18:10 EDT 2016
 > export LC_ALL=de_DE  # use German (Deutschland) locale
 > date
Mi 22 Jun 2016 13:22:13 EDT
 > export LC_ALL=es_ES  # use Spanish (Español)
 > date
miércoles, 22 de junio de 2016, 13:39:34 EDT
 > export LC_ALL=fr_FR  # use French
 > date
Mer 22 jui 2016 13:39:44 EDT
Another example is the use by tr (translate) utility which fails if particular characters are in the input stream and LC_ALL=POSIX
Specifing export LC_ALL=C, tr will treat these characters as the C language does.

locale [ ‑a | ‑m=char_map]
locale [ ‑ck =] name...

Display information about the current locale environment, or all locales, to standard output.

When invoked without arguments, locale summarizes the current locale environment for each locale category defined by $LC_* variables.

‑a, ‑‑all‑locales output names of available locales.
> locale -a
af_ZA
af_ZA.ISO8859-1
af_ZA.ISO8859-15
af_ZA.UTF-8
am_ET
…
en_AU                       englist Austrialia
en_AU.ISO8859-1
en_AU.ISO8859-15
en_AU.US-ASCII
en_AU.UTF-8
en_CA                       english Canada
en_CA.ISO8859-1
en_CA.ISO8859-15
en_CA.US-ASCII
en_CA.UTF-8
en_GB                       english GreatBritian
en_GB.ISO8859-1
en_GB.ISO8859-15
en_GB.US-ASCII
en_GB.UTF-8
en_IE                       english Ireland
en_IE.UTF-8
en_NZ                       english New Zealand
en_NZ.ISO8859-1
en_NZ.ISO8859-15
en_NZ.US-ASCII
en_NZ.UTF-8
en_US                       english US
en_US.ISO8859-1
en_US.ISO8859-15
en_US.US-ASCII
en_US.UTF-8
…
‑m, ‑‑charmaps output names of available charmaps.
 > locale -m   #on OS X 
ISO8859-1
ISO8859-15
UTF-8
CP1131
CP1251
ISO8859-2
ISO8859-7
US-ASCII
ISCII-DEV
ISO8859-13
ISO8859-4
KOI8-U

Output Format:

‑c, ‑‑category‑name output names of selected categories.
 > locale -c postal_fmt
LC_ADDRESS
%a%N%f%N%d%N%b%N%h %s %e %r%N%T, %S %z%N%c%N
‑k, ‑‑keywordname output names and values of selected keywords.
‑v, ‑‑verbose
‑V, ‑‑version
‑?, ‑‑help
 
Environment Variables
LC_CTYPE Character classification and case conversion.
LC_COLLATE Collation order. (user by sort and regular expressions range)
LC_TIME Date and time formats.
LC_NUMERIC Non‑monetary numeric formats.
LC_MONETARY Monetary formats.
LC_MESSAGES Format and values for affirmative and negative responses (^[yY]; ^[nN].
Formats of informative and diagnostic messages and interactive responses.

> locale -ck decimal_point LC_NUMERIC
decimal_point="."
> locale -ck abmon # abbreviated month names
LC_TIME
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
> locale grouping -1
> locale am_pm AM;PM
> locale day Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday
> locale abday Sun;Mon;Tue;Wed;Thu;Fri;Sat
> locale mon January;February;March;April;May;June;July;August;September;October;November;December
> locale frac_digits 255

Sample output:

> locale
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C
 > locale -k LC_TIME
ab_day="Sun;Mon;Tue;Wed;Thu;Fri;Sat" 
    Thursday;Friday;Saturday"
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;
    Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;
    Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;
    May;June;July;August;September;
    October;November;December"
am_pm="AM;PM"
d_fmt="%m/%d/%y"
t_fmt="%H:%M:%S"
t_fmt_ampm="%I:%M:%S %p"
d_t_fmt="%a %b %e %H:%M:%S %Y"

era=
era_year=""
era_d_fmt=""
era_t_fmt=""
era_d_t_fmt=""
alt_digits=
time-era-num-entries=0
time-era-entries=""
week-ndays=7
week-1stday=19971130
week-1stweek=4
first_weekday=1
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %b %e %H:%M:%S %Z %Y"
time-codeset="ANSI_X3.4-1968"


On raspberry pi:
> locale -k LC_IDENTIFICATION
title="ISO/IEC 14652 i18n FDCC-set"
source="ISO/IEC JTC1/SC22/WG20 - internationalization"
address="C/o Keld Simonsen, Skt. Jorgens Alle 8, DK-1615"
contact="Keld Simonsen"
email="keld@dkuug.dk"
tel="+45 3122-6543"
fax="+45 3325-6543"
language=""
territory="ISO"
audience=""
application=""
abbreviation=""
revision="1.0"
date="1997-12-20"
category="i18n:1999;ANSI_X3.4-1968;;;;;;;;;;;"
identification-codeset="ANSI_X3.4-1968"


on  Linux

 > locale -k LC_IDENTIFICATION
title="English locale for the USA"
source="Free Software Foundation, Inc."
address="59 Temple Place - Suite 330, Boston, MA 02111-1307"
contact=""
email="bug-glibc-locales@gnu.org"
tel=""
fax=""
language="English"
territory="USA"
audience=""
application=""
abbreviation=""
revision="1.0"
date="2000-06-24"
category="en_US:2000;UTF-8;;;;;;;;;;;"
identification-codeset="UTF-8"


on OS X (unknown keyword)!





 > locale -k LC_CTYPE
ctype-class-names="upper";"lower";
    "alpha";"digit";"xdigit";"space";
    "print";"graph";"blank";"cntrl";
    "punct";"alnum";"combining";"combining_level3"
ctype-map-names="toupper";"tolower";"totitle"
ctype-width=16         or   7
ctype-mb-cur-max=6     or   1
charmap="UTF-8" or "ANSI_X3.4-1968"
ctype-class-offset=71  or 72
ctype-map-offset=85    or 84
ctype-indigits_mb-len=1
ctype-indigits0_mb="0"
…
ctype-indigits9_mb="9"
ctype-indigits_wc-len=1
ctype-outdigit0_mb="0"
…
ctype-outdigit9_mb="9"
ctype-outdigit0_wc=48
…
ctype-outdigit9_wc=57
ctype-translit-tab-size=4553
ctype-translit-default-missing-len=1
ctype-translit-ignore-len=0
ctype-translit-ignore=""
map-to-nonascii=0

OS X only charmap="US-ASCII"

 > locale -k LC_NUMERIC 
decimal_point="."
thousands_sep=""
grouping=-1
numeric-decimal-point-wc=46
numeric-thousands-sep-wc=0
numeric-codeset="ANSI_X3.4-1968"


on OS X    LC_ALL=C
decimal_point="."
thousands_sep=
grouping="0"


 > locale -k LC_ADDRESS  
postal_fmt="%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
country_name=""
country_post=""
country_ab2=""
country_ab3=""
country_car=""
country_num=-1225447716
country_isbn=""
lang_name=""
lang_ab=""
lang_term=""
lang_lib=""
address-codeset="ANSI_X3.4-1968"



> locale -k LC_TELEPHONE
tel_int_fmt="+%c %a %l"
tel_dom_fmt=""
int_select=""
int_prefix=""
telephone-codeset="ANSI_X3.4-1968"



cale -k LC_MEASUREMENT
measurement=1
measurement-codeset="ANSI_X3.4-1968"

 > locale -k LC_MONETARY
[duo_][int_]currency_symbol=""
       int_ international
mon_decimal_point=""
monetary-decimal-point-wc=0
mon_thousands_sep=""
monetary-thousands-sep-wc=0
mon_grouping=-1
positive_sign=""
negative_sign=""
[duo_][int_]frac_digits=255

[duo_][int_]p_cs_precedes=255
[duo_][int_]n_cs_precedes=255
[duo_][int_]p_sep_by_space=255
[duo_][int_]n_sep_by_space=255
[duo_][int_]p_sign_posn=255
[duo_][int_]n_sign_posn=255

[duo]uno_valid_from=10101
[duo]uno_valid_to=99991231
monetary-codeset="ANSI_X3.4-1968"

OS X uses 127 not 255, 
doesn't have duo; 
uses mon_grouping=0




> locale -k LC_COLLATE
collate-nrules=0
collate-rulesets=""
collate-symb-hash-sizemb=0
collate-codeset="ANSI_X3.4-1968"

OS X have no keywords

> locale -k LC_NAME    
name_fmt="%p%t%g%t%m%t%f"
name_gen=""
name_mr=""
name_mrs=""
name_miss=""
name_ms=""
name-codeset="ANSI_X3.4-1968"

 > locale -k LC_PAPER
height=297
width=210
paper-codeset="ANSI_X3.4-1968"


 > locale -k LC_MESSAGES
yesexpr="^[yY]"
noexpr="^[nN]"
yesstr=""
nostr=""
messages-codeset="ANSI_X3.4-1968"

OS X yesstr="yes"; nostr="no"



Sample output from locale ‑v ‑a :

Raspberry pi
linux-gnueabihf
locale: en_GB.utf8 archive: /usr/lib/locale/locale-archive
--------------------------------------------------------
    title | English locale for Britain
   source | RAP
  address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark
  contact | Keld Simonsen
    email | bug-glibc-locales@gnu.org
 language | English
territory | Great Britain
 revision | 1.0
     date | 2000-06-28
  codeset | UTF-8

locale: C.UTF-8  directory: /usr/lib/locale/C.UTF-8
---------------------------------------------------------
    title | C locale
    email | aurel32@debian.org
 language | C
 revision | 1.5
     date | 2012-11-18
  codeset | UTF-8
Linux
ls -l /usr/lib/locale
…
en_AU en_AU.utf8 (Austrialia
en_BW en_BW.utf8
en_CA en_CA.utf8 (Canada
en_DK en_DK.utf8
en_GB en_GB.iso885915 en_GB.utf8 (Great Britian
en_HK en_HK.utf8 (Hong Kong   
en_IE en_IE@euro en_IE.utf8 (Ireland
en_IN
en_NZ en_NZ.utf8 (New Zeland
en_PH en_PH.utf8
en_SG en_SG.utf8
en_US en_US.iso885915 en_US.utf8
en_ZA en_ZA.utf8
en_ZW en_ZW.utf8
…


locale -k -a 
partial

cale: en_AU    archive: /usr/lib/locale/locale-archive
-----------------------------------------------
    title | English locale for Australia
   source | RAP
  address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark
    email | bug-glibc-locales@gnu.org
 language | English
territory | Australia
 revision | 1.0
     date | 2000-06-29
  codeset | ISO-8859-1


archive: /usr/lib/locale/locale-archive      

Locale              Title 
an_ES.iso885915 Aragonese for Spain
danish          Danish for Denmark      
en_US           English for the USA      
en_US.iso88591  English for the USA      
en_US.utf8      English for the USA      
MAC OS X Darwin BSD
…
en_AU, en_AU.ISO8859-1, en_AU.ISO8859-15, en_AU.US-ASCII, en_AU.UTF-8
en_CA, en_CA.ISO8859-1, en_CA.ISO8859-15, en_CA.US-ASCII, en_CA.UTF-8
en_GB, en_GB.ISO8859-1, en_GB.ISO8859-15, en_GB.US-ASCII, en_GB.UTF-8
en_IE, en_IE.UTF-8
en_NZ, en_NZ.ISO8859-1, en_NZ.ISO8859-15, en_NZ.US-ASCII, en_NZ.UTF-8
en_US, en_US.ISO8859-1, en_US.ISO8859-15, en_US.US-ASCII, en_US.UTF-8
…

on linux:

 locale -k LC_CTYPE
ctype-class-names="upper";"lower";"alpha";"digit";"xdigit";"space";"print";"graph";"blank";"cntrl";
                    "punct";"alnum";"combining";"combining_level3"
ctype-map-names="toupper";"tolower";"totitle"
ctype-width=16         or   7
ctype-mb-cur-max=6     or   1
charmap="UTF-8"        or "ANSI_X3.4-1968"
ctype-class-offset=71  or 72
ctype-map-offset=85    or 84
ctype-indigits_mb-len=1
ctype-indigits0_mb="0"
…
ctype-indigits9_mb="9"
ctype-indigits_wc-len=1
ctype-outdigit0_mb="0"
…
ctype-outdigit9_mb="9"
ctype-outdigit0_wc=48
…
ctype-outdigit9_wc=57
ctype-translit-tab-size=4553
ctype-translit-default-missing-len=1
ctype-translit-ignore-len=0
ctype-translit-ignore=""
map-to-nonascii=0


On OS X :
 locale -k LC_CTYPE
charmap="US-ASCII" 

From apple darwin: /usr/include/xlocale/
 /usr/include/_locale.h

localeconv() returns a pointer to a structure which provides parameters for formatting numbers, 
        especially Monetary currency values:

           struct lconv {
                   char    *decimal_point, *thousands_sep,  *grouping;

                   char    *int_curr_symbol;   char    *currency_symbol;
                   char    *mon_decimal_point, *mon_thousands_sep;
                   char    *mon_grouping;
                   char    *positive_sign, *negative_sign;
                   char    int_frac_digits;
                   char    frac_digits;
                   char    p_cs_precedes;       char p_sep_by_space;
                   char    n_cs_precedes;       char n_sep_by_space;
                   char    p_sign_posn;         char n_sign_posn;
                   char    int_p_cs_precedes;   char int_n_cs_precedes;
                   char    int_p_sep_by_space;  char int_n_sep_by_space;
                   char    int_p_sign_posn;     char int_n_sign_posn; }; 

     decimal_point      except for Monetary currency values. Cannot be an empty string.  
     thousands_sep      separator between groups of digits before the decimal point, except for currency values.  
     grouping           sizes of the groups of digits, except for currency values.  
                         This is a pointer to a vector of integers, each of size char, 
                        representing group size from low order digit groups to high order (right to left).      
                        The list may be terminated with 0 or CHAR_MAX.      
                          with 0, the last group size before the 0 is repeated to account for all the digits.  
                          with CHAR_MAX, no more grouping is performed.
Monetary Currency related:
     int_curr_symbol    standardized international currency symbol.  
     currency_symbol    local currency symbol.  
     mon_decimal_point  decimal point character for monetary values.  
     mon_thousands_sep  separator for digit groups  …
     mon_grouping       Like grouping …
     positive_sign      character to denote positive Monetary currency values, usually the empty string.  
     negative_sign      character to denote negative Monetary currency values, usually a minus sign.  
     int_frac_digits    number of digits after the decimal point in an international-style Monetary currency value.  
     frac_digits        number of digits after the decimal point in the local style for Monetary currency values.  

     p_cs_precedes      1: currency symbol precedes the currency value for POSITIVE values, 0 if it follows.  
     p_sep_by_space     1: a space is inserted between the currency symbol and the value for POSITIVE values, 0 otherwise.  
     n_cs_precedes      for negative values.  
     n_sep_by_space     for negative values
     p_sign_posn        location of the positive_sign with respect to a POSITIVE quantity and the currency_symbol: 
                        0    Parentheses around the entire string.
                        1    Before the string.            2    After the string.
                        3    Just before currency_symbol.  4    Just after currency_symbol.

     n_sign_posn        Like p_sign_posn but for negative currency values.  

  for internationally formatted monetary quantities.  
     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    

     Unless mentioned above, an empty string as a value for a field indicates a zero length result or a value that is not in
     the current locale.  A CHAR_MAX result similarly denotes an unavailable value.

     While the localeconv() function uses the current locale, the localeconv_l() function may be passed a locale directly. See xlocale(3) for more information.
     
RETURN VALUES
     returns a pointer to a static object which may be altered by later calls to setlocale(3) or localeconv().  


_wctype.h
  #if !defined(_DONT_USE_CTYPE_INLINE_) && \
      (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
    __DARWIN_WCTYPE_TOP_static_inline int
 iswctype_l(wint_t _wc, wctype_t _charclass, locale_t _l) { return (__istype_l(_wc, _charclass, _l)); }
 DARWIN_WCTYPE_… removed from following for brevity
 iswalnum_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_A|_CTYPE_D, _l)); }
 iswalpha_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_A, _l)); }
 iswcntrl_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_C, _l)); }
 iswdigit_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_D, _l)); }
 iswgraph_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_G, _l)); }
 iswlower_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_L, _l)); }
 iswprint_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_R, _l)); }
 iswpunct_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_P, _l)); }
 iswspace_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_S, _l)); }
 iswupper_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_U, _l)); }
 iswxdigit_l(wint_t _wc, locale_t _l) { return (__istype_l(_wc, _CTYPE_X, _l)); } 
 towlower_l(wint_t _wc, locale_t _l) { return (__tolower_l(_wc, _l)); }
 towupper_l(wint_t _wc, locale_t _l) { return (__toupper_l(_wc, _l)); }
    
    #else             /* not using inlines */
    int iswctype_l(wint_t, wctype_t, locale_t);
    int iswalnum_l(wint_t, locale_t);
    int iswalpha_l(wint_t, locale_t);
    int iswcntrl_l(wint_t, locale_t);
    int iswdigit_l(wint_t, locale_t);
    int iswgraph_l(wint_t, locale_t);
    int iswlower_l(wint_t, locale_t);
    int iswprint_l(wint_t, locale_t);
    int iswpunct_l(wint_t, locale_t);
    int iswspace_l(wint_t, locale_t);
    int iswupper_l(wint_t, locale_t);
    int iswxdigit_l(wint_t, locale_t);
wint_t  towlower_l(wint_t, locale_t);
wint_t  towupper_l(wint_t, locale_t);
  
wctype_t wctype_l(const char *, locale_t); 
    
_string.h
_stdlib.h
_stdio.h __DARWIN_LDBL_COMPAT2 int asprintf_l(char **, locale_t, const char *, ...) (asprintf_l) __printflike(3, 4); int fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...) (fprintf_l) __printflike(3, 4); int fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...) (fscanf_l) __scanflike(3, 4); int printf_l(locale_t, const char * __restrict, ...) (printf_l) __printflike(2, 3); int scanf_l(locale_t, const char * __restrict, ...) (scanf_l) __scanflike(2, 3); int snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, ...) (snprintf_l) __printflike(4, 5); int sprintf_l(char * __restrict, locale_t, const char * __restrict, ...) (sprintf_l) __printflike(3, 4); int sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...) (sscanf_l) __scanflike(3, 4); int vasprintf_l(char **, locale_t, const char *, va_list) (vasprintf_l) __printflike(3, 0); int vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, va_list) (vfprintf_l) __printflike(3, 0); int vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, va_list) (vfscanf_l) __scanflike(3, 0); int vprintf_l(locale_t, const char * __restrict, va_list) (vprintf_l) __printflike(2, 0); int vscanf_l(locale_t, const char * __restrict, va_list) (vscanf_l) __scanflike(2, 0); int vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, va_list) (vsnprintf_l) __printflike(4, 0); int vsprintf_l(char * __restrict, locale_t, const char * __restrict, va_list) (vsprintf_l) __printflike(3, 0); int vsscanf_l(const char * __restrict, locale_t, const char * __restrict, va_list) (vsscanf_l) __scanflike(3, 0);
_monetary.h ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...) __strfmonlike(4, 5); _langinfo.h char *nl_langinfo_l(nl_item, locale_t); _inttypes.h __wctype.h _wchar.h _ctype.h
_time.h # ↓ size_t strftime_l( char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t) __DARWIN_ALIAS(strftime_l) __strftimelike(3); # ↓ ↓ char *strptime_l( const char * __restrict, const char * __restrict, struct tm * __restrict, locale_t) __DARWIN_ALIAS(strptime_l) __strftimelike(2);

Contents of /usr/lib/locale/en_US.utf8 on x86_64-redhat-linux-gnu
LC_ADDRESS 
LC_COLLATE 
LC_CTYPE    "POSIX"   
LC_IDENTIFICATION 
LC_MEASUREMENT
LC_MESSAGES/ 
LC_MONETARY 
LC_NAME 
LC_NUMERIC 
LC_PAPER 
LC_TELEPHONE 
LC_TIME

hexdump -C LC_ADDRESS
00  21 08 00 20 0d 00 00 00  3c 00 00 00 66 00 00 00  
10  6a 00 00 00 6e 00 00 00  71 00 00 00 75 00 00 00  
20  7c 00 00 00 80 00 00 00  82 00 00 00 8a 00 00 00  
30  8d 00 00 00 91 00 00 00  95 00 00 00 25 61 25 4e               %a%N|    
40  25 66 25 4e 25 64 25 4e  25 62 25 4e 25 68 20 25  |%f%N%d%N%b%N%h %|    
50  73 20 25 65 20 25 72 25  4e 25 25 54 20 25 7a 25  |s %e %r%N%%T %z%|    
60  4e 25 63 25 4e 00 55 53  41 00 55 53 41 00 55 53  |N%c%N.USA.USA.US|    
70  00 55 53 41 00 55 53 41  00 00 00 00 48 03 00 00  |.USA.USA        |    
80  30 00 45 6e 67 6c 69 73  68 00 65 6e 00 65 6e 67  |0.English.en.eng|    
90  00 65 6e 67 00 55 54 46  2d 38 00                 |.eng.UTF-8.
LC_COLLATE is used by sort, grep and regular expression ranges
Hexdumps
en_US
C With LC_COLLATE=C so will sort in uppercase letter before lowercase
en_GB
   
hexdump -C  LC_MEASUREMENT   
00  23 08 00 20 02 00 00 00  10 00 00 00 11 00 00 00  |#
10  02 55 54 46 2d 38 00                              |.UTF-8.|   

hexdump -d 

00   02083   08192   00002   00000   00016   00000   00017   00000
DaPie:/usr/lib/locale/C.UTF-8/LC_MESSAGES > hexdump -C *
00000000  10 11 03 20 05 00 00 00  1c 00 00 00 22 00 00 00  |... ........"...|
00000010  28 00 00 00 29 00 00 00  2a 00 00 00 5e 5b 79 59  |(...)...*...^[yY|
00000020  5d 00 5e 5b 6e 4e 5d 00  00 00 55 54 46 2d 38 00  |].^[nN]...UTF-8.|
00000030

   
hexdump -C LC_PAPER   
00  2f 08 00 20 03 00 00 00  14 00 00 00 18 00 00 00  
10  1c 00 00 00 17 01 00 00  d8 00 00 00 55 54 46 2d  |            UTF-|   
20  38 00                                             |8.|   

hexdump -d 

00   02095   08192   00003   00000   00020   00000   00024   00000   
10   00028   00000   00279   00000   00216  
20   00056   

   
hexdump -C LC_NUMERIC   
00  29 08 00 20 06 00 00 00  20 00 00 00 22 00 00 00 
10  24 00 00 00 28 00 00 00  2c 00 00 00 30 00 00 00
20  2e 00 2c 00 03 03 00 00  2e 00 00 00 2c 00 00 00
30  55 54 46 2d 38 00                                 |UTF-8.|   

hexdump -d LC_NUMERIC

   
00   04372   08195   00006   00000   00032   00000   00034   00000
10   00036   00000   00040   00000   00044   00000   00048   00000
20   00046   00044   00771   00000   00046   00000   00044   00000
   
hexdump -C LC_NAME 
20 08 00 20 07 00 00 00  24 00 00 00 33 00 00 00  
34 00 00 00 38 00 00 00  3d 00 00 00 43 00 00 00  
47 00 00 00 25 64 25 74  25 67 25 74 25 6d 25 74  |    %d%t%g%t%m%t|   
25 66 00 00 4d 72 2e 00  4d 72 73 2e 00 4d 69 73  |%f..Mr..Mrs..Mis|   
73 2e 00 4d 73 2e 00 55  54 46 2d 38 00           |s..Ms..UTF-8.|   

   
hexdump -C LC_TELEPHONE
00  22 08 00 20 05 00 00 00  1c 00 00 00 28 00 00 00  
10  30 00 00 00 33 00 00 00  35 00 00 00 2b 25 63 20                %c |    
20  28 25 61 29 20 25 6c 00  28 25 61 29 20 25 6c 00  |(%a) %l.(%a) %l.|    
30  31 31 00 31 00 55 54 46  2d 38 00                 |11.1.UTF-8.|    

   
hexdump -C LC_MONETARY   
     00 01 02 03              08 09 0a 0b
                 04 05 06 07              0c 0d 0e 0f
 00  2c 08 00 20 2e           C0          C5
 10  C7          C9           CB          CE
 20  Cf          D1           D2          D3   D4 D5 D6 D7  D8 D9 
     DC          DD           DE          DF   E0 E1 E2
                 E7           E9          EA              
 70  EB EC ED EE  EF F0 F1 F2  F3 F4 F5 F6 __
 A0  F8          FC          100         104
 B0 108         110          114         118

 C0  55 53 44 20 00                                    |USD  $   ,     -|   
 C5  24    
 C7  2E     
 C9  2C    03 03    00 2d                             
 D0  00 02 02 01 00 01 00 01  01 2d 24 00 01 00 01 00  |         -$     |   
 E0  01 01 55 53 44 20 00 24  00 02 02 01 00 01 00 01  |  USD  $        |   
 F0  00 01 00 01 01 01 01     75 27       bf be f5 05  |        u       |   
100  75 27       bf be f5 05  01          01           |u               |   
110  2e          2c                                    |        UTF-8   |   
hexdump -d 
00    2092   08192     046             192             197           
10     199             201             203             206          
20     207             209   -

40                     217             220 -

60     226             231             233 -           246

a0     248             252             256             260        
b0     264             272             276             280         
c0                  03 03          
d0     00 02 02 01 00 01 00 01 01 -$ 00 01 00 01 00
e0     01 01                     512     258     256     256    
f0 00 01 00 01 01 01 01 00 10101 00 00 BFBE F505
00 10101 0 48831 1525 1 1
10 46 44

                                              4 byte displayments into this table
hexdump -x LC_TIME    there must be a c header for this as a struct
000 1117   2003    06f    1C4
008  1C8    1C4                 day o week [0]
010  1cc    1d0    1D4    1D8   
020  1dc    1E0    1E7    1EE    1E0 daynameOWeek[0], 1E7 [1], 1EE [2]
030  1f6    200    209    210   
040  219    21d    221    225    219 mon o yr  [0]
050  229    22d    231    235  
060  239    23d    241    245   
070  249    251    25a    260    249 monthnamesOYear [0]
080  266    26A    26F    274  
090  27B    285    28d    296  
0A0  29F    2A2    2A5    2B7    29F AM and PM strings,   2A5 DATE format
0B0  2C0    2C3    2CF    2CF  
0C0  2D0    2D1    335    336    2D0 02D1 335 next day o week  string set
0D0  338    33c    33c    34c  
0E0  35C    36C    37c    38c  
0F0  39C    3aC    3c8    3e4  
100  404    42C    450    46c  
110  490    4A0    4B0    4C0  4D0    4E0    4F0    500  
130  510    520    530    540  
140  550    570    594    5ac  
150  5C4    5D4    5E8    5FC  
160  618    640    660    684  
170  6A8    6B4    6C0    708    
180  72c    738    768    76c  
190  770    900    904    908  
1A0  90C    910    911    912  
1B0  913    914    915    930  
1C0  990   7553    06E 

1C0  8d 09 00 00 
1C4 Sun.Mon.Tue.Wed.Thu.Fri.Sat.  
1E0 Sunday.Monday.Tuesday.Wednesday.Thursday.Friday.Saturday.
219 Jan.Feb.Mar.Apr.May.Jun.Jul.Aug.Sep.Oct.Nov.Dec.
249 January.February.March.April.May.June.July.August.September.October.November.December.
29F AM.PM.%a %d %b %Y %r %Z.%m/%d/%Y.%r.%I:%M:%S %p..
2C0 7225  2500  3A49  4d25  253A  2053  7025  0000
2d0
*
320
330                                                    0053        

Following commpressed for readability,
330   Sun.Mon.Tue.Wed.Thu.Fri.Sat.S
3b0 unday  .Monday.Tuesday
400 .Wednesday  .Thursday.
450 Friday.Saturday.
490 Jan.  4a0 Feb.  4b0 Mar.  4c0 Apr.  4d0 May.  4e0 Jun.  4f0 Jul.  500 Aug.
510 Sep.  520 Oct.  530 Nov.  540 Dec.
550 January.
570 February.
591 March.April.
5C1 May.
5D1 June.July.August.
612 September.
640 October.
660 November.
681 December.
6A2 AM.
6B1 PM.

6C0 %a%d%b%Y%r%Z.%m/%d/%Y.%r.%I:%M:%S%p
*
908  07 00 00 00 81 bc 30 01  
910  04 01 01 01 00             
      |     %a %b %e %H:%M:%S %Z %Y.%..|
930   | a       %   b       %   e       %   H   :   %   M   :   %   S       %   Z       %   Y       UTF|
990   |-8 

…  
Sample output from ‑m (CHAR_MAPS)
ANSI_X3.110‑1983 ANSI_X3.4‑1968 ARMSCII‑8 ASMO_449 
BIG5 BIG5‑HKSCS BS_4730 BS_VIEWDATA
CP10007 CP1125 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255
CP1256 CP1257 CP1258 CP737 CP775 CP949 CSA_Z243.4‑1985‑1 CSA_Z243.4‑1985‑2
CSA_Z243.4‑1985‑GR CSN_369103 CWI 
DEC‑MCS DIN_66003 DS_2089 
EBCDIC‑AT‑DE EBCDIC‑AT‑DE‑A
EBCDIC‑CA‑FR EBCDIC‑DK‑NO EBCDIC‑DK‑NO‑A 
EBCDIC‑ES EBCDIC‑ES‑A EBCDIC‑ES‑S EBCDIC‑FI‑SE 
EBCDIC‑FI‑SE‑A EBCDIC‑FR EBCDIC‑IS‑FRISS EBCDIC‑IT 
EBCDIC‑PT EBCDIC‑UK EBCDIC‑US 
ECMA‑CYRILLIC ES
ES2 EUC‑JISX0213 EUC‑JP EUC‑JP‑MS EUC‑KR EUC‑TW 
GB18030 GB2312
GBK GB_1988‑80 GEORGIAN‑ACADEMY GEORGIAN‑PS GOST_19768‑74 
GREEK‑CCITT GREEK7 GREEK7‑OLD
HP‑ROMAN8 
IBM037 IBM038 IBM1004 IBM1026 IBM1047 IBM1124 IBM1129
IBM1132 IBM1133 IBM1160 IBM1161 IBM1162 IBM1163 IBM1164 IBM256
IBM273 IBM274 IBM275 IBM277 IBM278 IBM280 IBM281 IBM284
IBM285 IBM290 IBM297 IBM420 IBM423 IBM424 IBM437 IBM500
IBM850 IBM851 IBM852 IBM855 IBM856 IBM857 IBM860 IBM861
IBM862 IBM863 IBM864 IBM865 IBM866 IBM866NAV IBM868 IBM869
IBM870 IBM871 IBM874 IBM875 IBM880 IBM891 IBM903 IBM904
IBM905 IBM918 IBM922 IEC_P27‑1 INIS INIS‑8 INIS‑CYRILLIC INVARIANT
ISIRI‑3342 
ISO‑8859‑1 ISO‑8859‑10 ISO‑8859‑11 ISO‑8859‑13 ISO‑8859‑14 ISO‑8859‑15 ISO‑8859‑16
ISO‑8859‑2 ISO‑8859‑3 ISO‑8859‑4 ISO‑8859‑5 ISO‑8859‑6 ISO‑8859‑7 ISO‑8859‑8 ISO‑8859‑9
ISO‑IR‑197 ISO‑IR‑209 ISO‑IR‑90 ISO_10367‑BOX ISO_10646 ISO_2033‑1983 
ISO_5427 ISO_5427‑EXT
ISO_5428 ISO_646.BASIC ISO_646.IRV 
ISO_6937 ISO_6937‑2‑25 ISO_6937‑2‑ADD 
ISO_8859‑1,GL ISO_8859‑SUPP IT i
JIS_C6220‑1969‑JP JIS_C6220‑1969‑RO 
JIS_C6229‑1984‑A JIS_C6229‑1984‑B JIS_C6229‑1984‑B‑ADD
JIS_C6229‑1984‑HAND JIS_C6229‑1984‑HAND‑ADD
JIS_C6229‑1984‑KANA JIS_X0201 
JOHAB JUS_I.B1.002 JUS_I.B1.003‑MAC JUS_I.B1.003‑SERB 
KOI‑8 KOI8‑R
KOI8‑T KOI8‑U KSC5636 
LATIN‑GREEK LATIN‑GREEK‑1 
MAC‑CYRILLIC MAC‑IS MAC‑SAMI MAC‑UK MACINTOSH 
MSZ_7795.3 
NATS‑DANO NATS‑DANO‑ADD
NATS‑SEFI NATS‑SEFI‑ADD
NC_NC00‑10
NEXTSTEP 
NF_Z_62‑010 NF_Z_62‑010_(1973) NF_Z_62‑010_1973 NS_4551‑1 NS_4551‑2 
PT PT2
SAMI SAMI‑WS2 SEN_850200_B SEN_850200_C 
SHIFT_JIS SHIFT_JISX0213 
T.101‑G2 T.61‑7BIT T.61‑8BIT TCVN5712‑1 TIS‑620 TSCII 
UTF‑8 
VIDEOTEX‑SUPPL VISCII 
WIN‑SAMI‑2 WINDOWS‑31J

#include <stdio.h>
#include <locale.h>
#include <time.h>

int main(void)
{
    char buf[100];
    time_t t;
    struct tm *timeptr,result;

    if ( setlocale(LC_ALL,"POSIX")  == NULL ) printf("\n - setLocale  POSIX failed \n");
    if ( setlocale(LC_ALL,"de_DE")  == NULL ) printf("\n - setLocale  de_DE failed \n");
    if ( setlocale(LC_ALL,"ja_JP")  == NULL ) printf("\n - setLocale  ja_JP failed \n");
    t = time(NULL);
    timeptr = localtime(&t);
    strftime(buf,sizeof(buf), "%a %m/%d/%Y %r", timeptr);
    printf(":: %s ::",buf);
    if(strptime(buf, "%a %m/%d/%Y %r",&result) == NULL) printf("\nstrptime failed\n");
   else { printf("tm_hour,min: %d:%02d:%02d ",result.tm_hour,result.tm_min,result.tm_sec);
          printf("mon/mday/year: %d/%02d/%d, ",result.tm_mon,result.tm_mday, result.tm_year);
          printf("yday: %d, ",result.tm_yday);
          printf("wday: %d  \n",result.tm_wday); }

   return 0;
}
With POSIX ::
With de_DE ::Sonntag 09/04/2011 03:35:17 pm:: tm_hour,min: 15:35:17 mon/mday/year: 8/04/111, yday: 32767, wday: 0
With jp_JP :: 日曜日 09/04/2011 03:34:38 PM:: tm_hour,min: 15:34:38 mon/mday/year: 8/04/111, yday: 32767, wday: 0

3rd Berkeley Distribution March 2001


localedef - compile locale definition files

localedef [-f charmapfile] [-i inputfile] [--force] [--verbose] [--posix] [--quiet] outputpath

Compiles charmap and input files into a form usable by the locale(7) functions in the C library, and places the six output files in the outputpath directory.

If no is given, POSIX is used by default.
If no Eainputfile is given, or if it is given as -, reads from standard input.

If multiple short options are used, they can be combined (e.g. -cv).
If an option takes an argument, the argument can be given separately as the next word, or it can be writen as option=argument.

 -f file
--charmap=file
Defines the symbolic character names used by the input file. If the file is in the default directory for character maps, it is not necessary to specify the full pathname. This default directory is printed by localedef --help.
 -i file
‑‑inputfile=file
Specify the locale definition file to compile. If file is not absolute, localedef will also look in the directory specified by the environment variable I18NPATH and in the default directory for locale definition files. This default directory is printed by --help.
 -c
--force
Write the output files even if warnings were generated about the input file.
 -v
--verbose
Generate extra warnings about errors that are normally ignored.
 --quiet Suppress notifications and warnings, report only fatal errors.
 --posix Be strictly POSIX conformant. Implies --verbose. Assumed if the environment variable POSIXLY_CORRECT is set.
 -u codeset
--code-set-name=codeset
ignored.
 -h
--help
Usage: localedef [OPTION...] NAME
  or:  localedef [OPTION...] [--add-to-archive|--delete-from-archive] FILE...
  or:  localedef [OPTION...] --list-archive [FILE]
Compile locale specification

 Input Files:
  -f, --charmap=FILE         Symbolic character names defined in FILE
  -i, --inputfile=FILE       Source definitions are found in FILE
  -u, --repertoire-map=FILE  FILE contains mapping from symbolic names to UCS4
                             values

 Output control:
  -c, --force                Create output even if warning messages were issued
                            
      --old-style            Create old-style tables
      --posix                Be strictly POSIX conform
      --prefix=PATH          Optional output file prefix
      --quiet                Suppress warnings and information messages
  -v, --verbose              Print more messages

 Archive control:
      --add-to-archive       Add locales named by parameters to archive
  -A, --alias-file=FILE      locale.alias file to consult when making archive
      --delete-from-archive  Remove locales named by parameters from archive
      --list-archive         List content of archive
      --no-archive           Don't add new data to archive
      --replace              Replace existing archive content

System's directory for character maps : /usr/share/i18n/charmaps
                       repertoire maps: /usr/share/i18n/repertoiremaps
                       locale path    : /usr/lib/locale:/usr/share/i18n
       
 -V
--version

ENVIRONMENT

POSIXLY_CORRECT The --posix flag is assumed if this environment variable is set.
I18NPATH The default directory for locale definition files.

FILES

/usr/share/i18n/charmaps Usual default charmap path.
/usr/share/locale Usual default output path. See the output from localedef --help for the paths used in your version.
outputpath/LC_COLLATE rules for comparing strings in the locale's alphabet.
outputpath/LC_CTYPE contains information about character cases and case conversions
outputpath/LC_MONETARY the way monetary values should be formatted
outputpath/LC_MESSAGES/SYS_LC_MESSAGES contains information about the language messages should be printed in, and what an affirmative or negative answer looks like.
outputpath/LC_NUMERIC rules for formatting numbers
outputpath/LC_TIME rules for formatting times and dates
/usr/share/locale > find . -name LC_COLLATE -ls |sed -f ~/bin/find.sed |g -v la_LN |sort -n
        29 Sep 16 00:07 ./de_AT.ISO8859-1/LC_COLLATE -> ../de_DE.ISO8859-1/LC_COLLATE
        29 Sep 16 00:07 ./sk_SK.ISO8859-2/LC_COLLATE -> ../cs_CZ.ISO8859-2/LC_COLLATE
      2130  ./de_DE.ISO8859-1/LC_COLLATE
      2130  ./de_DE.ISO8859-15/LC_COLLATE
      2274  ./cs_CZ.ISO8859-2/LC_COLLATE
      2518  ./ca_ES.ISO8859-1/LC_COLLATE
      2518  ./ca_ES.ISO8859-15/LC_COLLATE
      2518  ./es_ES.ISO8859-1/LC_COLLATE
      2518  ./es_ES.ISO8859-15/LC_COLLATE
      2130  ./et_EE.ISO8859-15/LC_COLLATE
      2086  ./be_BY.CP1131/LC_COLLATE
      2086  ./be_BY.CP1251/LC_COLLATE
      2086  ./be_BY.ISO8859-5/LC_COLLATE
      2086  ./bg_BG.CP1251/LC_COLLATE
      2086  ./el_GR.ISO8859-7/LC_COLLATE
      2086  ./hi_IN.ISCII-DEV/LC_COLLATE
      2130  ./hy_AM.ARMSCII-8/LC_COLLATE
      2086  ./is_IS.ISO8859-1/LC_COLLATE
      2086  ./is_IS.ISO8859-15/LC_COLLATE
      2086  ./kk_KZ.PT154/LC_COLLATE
      2086  ./lt_LT.ISO8859-13/LC_COLLATE
      2086  ./lt_LT.ISO8859-4/LC_COLLATE
      2086  ./pl_PL.ISO8859-2/LC_COLLATE
      2086  ./ru_RU.CP1251/LC_COLLATE
      2086  ./ru_RU.CP866/LC_COLLATE
      2086  ./ru_RU.ISO8859-5/LC_COLLATE
      2086  ./ru_RU.KOI8-R/LC_COLLATE
      2086  ./sl_SI.ISO8859-2/LC_COLLATE
      2086  ./sr_YU.ISO8859-5/LC_COLLATE
      2086  ./sv_SE.ISO8859-1/LC_COLLATE
      2086  ./sv_SE.ISO8859-15/LC_COLLATE
      2086  ./uk_UA.ISO8859-5/LC_COLLATE
      2086  ./uk_UA.KOI8-U/LC_COLLATE