> set |grep LC LC_ALL=C > date Wed Jun 22 13:18:10 EDT 2021 > export LC_ALL=de_DE # use German (Deutschland) locale > date Mi 22 Jun 2021 13:22:13 EDT > export LC_ALL=es_ES # use Spanish (Español) > date miércoles, 22 de junio de 2021, 13:39:34 EDT date +%x 22/06/2021 date +%D # and GB ! 06/22/21 > export LC_ALL=fr_FR # use French > date Mer 22 jui 2021 13:39:44 EDT > export LC_ALL=en_US > date +"%x %D" 02/04/2021 02/04/21Another example is the use by
tr
(translate) utility which fails if particular characters are in the input stream and
LC_ALL=POSIX
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 |
locale -ck decimal_point |
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" t_fmt="%H:%M:%S" t_fmt_ampm="%I:%M:%S %p" d_fmt="%m/%d/%y" d_t_fmt="%a %b %e %H:%M:%S %Y" date_fmt="%a %b %e %H:%M:%S %Z %Y" ⌘ > date Mac OS Fri May 14 11:26:26 EDT 2021 sic 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="" ⌘ 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 mac os (unknown keyword)!⌘ |
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 | Linuxls -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 -apartial 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-archiveLocale 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 |
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=0On mac os : 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 Monetarycurrencyvalues: 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 Monetarycurrencyvalues. 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. MonetaryCurrencyrelated: 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 Monetarycurrencyvalues, usually the empty string. negative_sign character to denote negative Monetarycurrencyvalues, usually a minus sign. int_frac_digits number of digits after the decimal point in an international-style Monetarycurrencyvalue. frac_digits number of digits after the decimal point in the local style for Monetarycurrencyvalues. 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
onx86_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 bysort, grep
and regular expression ranges
en_US
C With LC_COLLATE=C so will sort in uppercase letter before lowercase
en_GB
hexdump -C LC_MEASUREMENT 23 08 00 20 02 00 00 00 10 00 00 00 11 00 00 00 |# 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/ hexdump -C LC_MESSAGES 10 11 03 20 05 00 00 00 1c 00 00 00 22 00 00 00 |... ........"...| 28 00 00 00 29 00 00 00 2a 00 00 00 5e 5b 79 59 |(...)...*...^[yY| hexdump -C LC_PAPER 2f 08 00 20 03 00 00 00 14 00 00 00 18 00 00 00 1c 00 00 00 17 01 00 00 d8 00 00 00 55 54 46 2d | UTF-| 38 00 |8.| hexdump -d 02095 08192 00003 00000 00020 00000 00024 00000 00028 00000 00279 00000 00216 00056 hexdump -C LC_NUMERIC 29 08 00 20 06 00 00 00 20 00 00 00 22 00 00 00 24 00 00 00 28 00 00 00 2c 00 00 00 30 00 00 00 2e 00 2c 00 03 03 00 00 2e 00 00 00 2c 00 00 00 55 54 46 2d 38 00 |UTF-8.| hexdump -d LC_NUMERIC 04372 08195 00006 00000 00032 00000 00034 00000 00036 00000 00040 00000 00044 00000 00048 00000 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 22 08 00 20 05 00 00 00 1c 00 00 00 28 00 00 00 30 00 00 00 33 00 00 00 35 00 00 00 2b 25 63 20 %c | 28 25 61 29 20 25 6c 00 28 25 61 29 20 25 6c 00 |(%a) %l.(%a) %l.| 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 |Sample output from
hexdump -d 2092 08192 046 192 197 199 201 203 206 207 209 - 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 hexdump -x LC_TIME there must be ac
header for this as astruct
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 …-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; }WithPOSIX ::
Withde_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
Withjp_JP :: 日曜日 09/04/2011 03:34:38 PM:: tm_hour,min: 15:34:38 mon/mday/year: 8/04/111, yday: 32767, wday: 0
See
etc/ssh/ssh_config or ~/.ssh/config
which may contain something like:Host * SendEnv LANG LC_*
localedef - compile locale definition files
localedef [-f charmapfile] [-i inputfile] [--force] [--verbose] [--posix] [--quiet] outputpath
Compiles charmap and input files for
locale
functions in the C library, and places the six output files inoutputpath
.
-f file
--charmap=fileDefines the symbolic character names used by the input file.
DefaultPOSIX
-i file
--inputfile=fileIf file
is not absolute, localedef will also look in the directory specified by the environment variableI18NPATH
and in the default directory for locale definitions .-c
--forceWrite the output files even if warnings were generated about the input file. -v
--verboseGenerate 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$POSIXLY_CORRECT
is set.-u codeset
--code-set-name=codesetignored. -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
--versionENVIRONMENT
POSIXLY_CORRECT
--posix
is assumed if set.i18NPATH
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 de_AT.ISO8859-1 -> .de_DE.ISO8859-1 sk_SK.ISO8859-2 -> .cs_CZ.ISO8859-2 de_DE.ISO8859-1 de_DE.ISO8859-15 cs_CZ.ISO8859-2 ca_ES.ISO8859-1 ca_ES.ISO8859-15 es_ES.ISO8859-1 es_ES.ISO8859-15 et_EE.ISO8859-15 be_BY.CP1131 be_BY.CP1251 be_BY.ISO8859-5 bg_BG.CP1251 el_GR.ISO8859-7 hi_IN.ISCII-DEV hy_AM.ARMSCII-8 is_IS.ISO8859-1 is_IS.ISO8859-15 kk_KZ.PT154 lt_LT.ISO8859-13 lt_LT.ISO8859-4 pl_PL.ISO8859-2 ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.KOI8-R sl_SI.ISO8859-2 sr_YU.ISO8859-5 sv_SE.ISO8859-1 sv_SE.ISO8859-15 uk_UA.ISO8859-5 uk_UA.KOI8-UWriting locale-aware programs