Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/man/man.sh
Show First 20 Lines • Show All 656 Lines • ▼ Show 20 Lines | else | ||||
decho 'Using standard page width' | decho 'Using standard page width' | ||||
fi | fi | ||||
} | } | ||||
# Usage: man_setup_locale | # Usage: man_setup_locale | ||||
# Setup necessary locale variables. | # Setup necessary locale variables. | ||||
man_setup_locale() { | man_setup_locale() { | ||||
local lang_cc | local lang_cc | ||||
local locstr | |||||
locpaths='.' | locpaths='.' | ||||
man_charset='US-ASCII' | man_charset='US-ASCII' | ||||
# Setup locale information. | # Setup locale information. | ||||
if [ -n "$oflag" ]; then | if [ -n "$oflag" ]; then | ||||
decho 'Using non-localized manpages' | decho 'Using non-localized manpages' | ||||
else | else | ||||
# Use the locale tool to give us the proper LC_CTYPE | # Use the locale tool to give us proper locale information | ||||
eval $( $LOCALE ) | eval $( $LOCALE ) | ||||
case "$LC_CTYPE" in | if [ -n "$LANG" ]; then | ||||
locstr=$LANG | |||||
else | |||||
locstr=$LC_CTYPE | |||||
fi | |||||
case "$locstr" in | |||||
C) ;; | C) ;; | ||||
C.UTF-8) ;; | |||||
POSIX) ;; | POSIX) ;; | ||||
[a-z][a-z]_[A-Z][A-Z]\.*) | [a-z][a-z]_[A-Z][A-Z]\.*) | ||||
lang_cc="${LC_CTYPE%.*}" | lang_cc="${locstr%.*}" | ||||
man_lang="${LC_CTYPE%_*}" | man_lang="${locstr%_*}" | ||||
man_country="${lang_cc#*_}" | man_country="${lang_cc#*_}" | ||||
man_charset="${LC_CTYPE#*.}" | man_charset="${locstr#*.}" | ||||
locpaths="$LC_CTYPE" | locpaths="$locstr" | ||||
locpaths="$locpaths:$man_lang.$man_charset" | locpaths="$locpaths:$man_lang.$man_charset" | ||||
if [ "$man_lang" != "en" ]; then | if [ "$man_lang" != "en" ]; then | ||||
locpaths="$locpaths:en.$man_charset" | locpaths="$locpaths:en.$man_charset" | ||||
fi | fi | ||||
locpaths="$locpaths:." | locpaths="$locpaths:." | ||||
;; | ;; | ||||
*) echo 'Unknown locale, assuming C' >&2 | *) echo 'Unknown locale, assuming C' >&2 | ||||
;; | ;; | ||||
▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines |