Bram Moolenaar writes:

>       % locale -a
>       locale: Command not found.
> 
> I'm on FreeBSD 4.2.  Perhaps Linux has this command.

Not only Linux. All SUSV2 compliant Unices have it. You might want
offer your help to Andrey Chernov <[EMAIL PROTECTED]> who is working
on i18n for FreeBSD 5.0.

>       % man 5 locale
>       No entry for locale in section 5 of the manual
>       % man 7 locale
>       No entry for locale in section 7 of the manual
> 
> You are probably going to suggest I install Linux instead...

No, but you might want to install the Linux manpages. Like I installed
copies of BSD manpages in 1993 when Linux didn't have good manpages :-)

> ... to find the directory that contains the locales.  For a portable
> program like Vim, is there a generic way that works on all Unix
> systems?

The best approximation I know of is the following.

========================================================================
#! /bin/sh
# Prints the list of all locale names, one per line.

locale -a
test $? = 0 && exit 0

host=`/bin/sh ../config.guess`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`

case "$host_os" in
  sunos* | solaris*)
    cd /usr/lib/locale && ls -1
    ;;
  freebsd*)
    cd /usr/share/locale && ls -1
    ;;
  *)
    echo "Don't know how to determine list of locales on $host_os" 1>&2
    exit 1
    ;;
esac
==========================================================================

> I still haven't heard a reason why setlocale() needs to be case-sensitive.

If the standards did specify that locale names are case sensitive,
it would be easy to implement that way. But the standards don't say
so...

Bruno
-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/

Reply via email to