[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sorting on country names



At 11:56 AM 1/21/00 -0500, James A. Treacy wrote:
On Fri, Jan 21, 2000 at 10:17:52AM +0100, peter karlsson wrote:
> James A. Treacy:
>
> > Since slices are handled in the last pass of wml, we can't use them in a
> > sort function. We'd have to put the countries in a perl hash.
>
> Can Perl be configured as to sort according to locale settings? The
> iso-8859-1 set unfortunately does not have the Swedish letters in order so
> that a direct string compare gives the correct order.
>
The sorting should be done properly. This is one of those areas which I'd
hope one of the translators would look into as they probably have more
experience with locales than I do (zero experience).

Any takers?

--
James (Jay) Treacy
treacy@debian.org

hi,
there is locale support in perl, see the perllocale man page , I have never used it. There is support for collation. There are some requirements, from the man page:

-Your operating system must support the locale system.
-Definitions for the locales which you use must be installed.
-Perl must believe that the locale system is supported. If it does, perl -V:d_setlocale will say that the value for d_setlocale is define


        # This functionality not usable prior to Perl 5.004
        require 5.004;
        # Import locale-handling tool set from POSIX module.
        use POSIX qw(locale_h);
        # query and save the old locale
        $old_locale = setlocale(LC_CTYPE);
        setlocale(LC_CTYPE, "fr_CA.ISO8859-1");
        # LC_CTYPE now in locale "French, Canada, codeset ISO 8859-1"




Reply to: