5 Notes
5.1 Locale Designators
The locale argument to the various locale accessors and to the print functions
is a locale designator. A locale designator is one of three things
- A locale object returned by
(locale name)
- A string designating a locale, “en_ZA”.
- A symbol eg. :|en_ZA|
5.2 The Default Locale
The default locale is found by looking at various environment variables.
If the CL_LOCALE environment variable is set then this locale is loaded.
Failing that the locale designated by the environment variable LC_CTYPE
is loaded. If these two have failed then the POSIX locale is loaded
as the default.
5.3 Time Format Control Characters
The following is a list of each legal control character in a time
format string followed by a description of what is does.
- %% A percentage sign.
- %a locale's abbreviated weekday name (Sun..Sat)
- %A locale's full weekday name, variable length (Sunday..Saturday)
- %b locale's abbreviated month name (Jan..Dec)
- %B locale's full month name, variable length (January..December)
- %c locale's date and time (Sat Nov 04 12:02:33 EST 1989)
- %C century [00-99]
- %d day of month (01..31)
- %D date (mm/dd/yy)
- %e day of month, blank padded ( 1..31)
- %F same as %Y-%m-%d
- %g the 2-digit year corresponding to the %V week number
- %G the 4-digit year corresponding to the %V week number
- %h same as %b
- %H hour (00..23)
- %I hour (01..12)
- %j day of year (001..366)
- %k hour ( 0..23)
- %l hour ( 1..12)
- %m month (01..12)
- %M minute (00..59)
- %n a newline
- %N nanoseconds (Always 000000000)
- %p locale's upper case AM or PM indicator (blank in many locales)
- %P locale's lower case am or pm indicator (blank in many locales)
- %r time, 12-hour (hh:mm:ss [AP]M)
- %R time, 24-hour (hh:mm)
- %s seconds since `00:00:00 1970-01-01 UTC'
- %S second (00..60)
- %t a horizontal tab
- %T time, 24-hour (hh:mm:ss)
- %u day of week (1..7); 1 represents Monday
- %U week number of year with Sunday as first day of week (00..53)
- %V week number of year with Monday as first day of week (01..53)
- %w day of week (0..6); 0 represents Sunday
- %W week number of year with Monday as first day of week (00..53)
- %x locale's date representation (locale-d-fmt)
- %X locale's time representation (locale-t-fmt)
- %y last two digits of year (00..99)
- %Y year (1900...)
- %z RFC-2822 style numeric timezone (-0500)
- %Z RFC-2822 style numeric timezone (-0500)
5.4 Accessors to Locale Values.
There are a number of accessor functions to the various locale
attributes defined. The functions are named by replacing
underscores with hypens and prepending locale- to the name.
The following is each defined accessor function in the format
Category, Keyword and the accessor function for it.
- LC_MONETARY int_curr_symbol
locale-int-curr-symbol
- LC_MONETARY currency_symbol
locale-currency-symbol
- LC_MONETARY mon_decimal_point
locale-mon-decimal-point
- LC_MONETARY mon_thousands_sep
locale-mon-thousands-sep
- LC_MONETARY mon_grouping
locale-mon-grouping
- LC_MONETARY positive_sign
locale-positive-sign
- LC_MONETARY negative_sign
locale-negative-sign
- LC_MONETARY int_frac_digits
locale-int-frac-digits
- LC_MONETARY frac_digits
locale-frac-digits
- LC_MONETARY p_cs_precedes
locale-p-cs-precedes
- LC_MONETARY p_sep_by_space
locale-p-sep-by-space
- LC_MONETARY n_cs_precedes
locale-n-cs-precedes
- LC_MONETARY n_sep_by_space
locale-n-sep-by-space
- LC_MONETARY p_sign_posn
locale-p-sign-posn
- LC_MONETARY n_sign_posn
locale-n-sign-posn
- LC_NUMERIC decimal_point
locale-decimal-point
- LC_NUMERIC thousands_sep
locale-thousands-sep
- LC_NUMERIC grouping
locale-grouping
- LC_TIME abday
locale-abday
- LC_TIME day
locale-day
- LC_TIME abmon
locale-abmon
- LC_TIME mon
locale-mon
- LC_TIME d_t_fmt
locale-d-t-fmt
- LC_TIME d_fmt
locale-d-fmt
- LC_TIME t_fmt
locale-t-fmt
- LC_TIME am_pm
locale-am-pm
- LC_TIME t_fmt_ampm
locale-t-fmt-ampm
- LC_TIME date_fmt
locale-date-fmt
- LC_MESSAGES yesexpr
locale-yesexpr
- LC_MESSAGES noexpr
locale-noexpr
- LC_PAPER height
locale-height
- LC_PAPER width
locale-width
- LC_NAME name_fmt
locale-name-fmt
- LC_NAME name_gen
locale-name-gen
- LC_NAME name_mr
locale-name-mr
- LC_NAME name_mrs
locale-name-mrs
- LC_NAME name_miss
locale-name-miss
- LC_NAME name_ms
locale-name-ms
- LC_ADDRESS postal_fmt
locale-postal-fmt
- LC_TELEPHONE tel_int_fmt
locale-tel-int-fmt
- LC_MEASUREMENT measurement
locale-measurement
5.5 Known Issues
- LC_COLLATE and LC_CTYPE categories in the locale files are currently ignored.
- Not all time format directives are supported (U, V and W are not implemented).