Item3680: I18N: Sorting does not match locale settings

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: I18N, TablePlugin
Branches:
Reported By: TWiki:Main.SergejZnamenskij
Waiting For:
Last Change By: CrawfordCurrie

Sorting in twiki tables, searchresults etc. does not match locale settings. Adding lines
            require POSIX;
            import POSIX qw( locale_h LC_CTYPE LC_COLLATE);
            setlocale(&LC_COLLATE, $TWiki::cfg{Site}{Locale});
to Search.pm and other related modules fixes the problem Tests shows that LC_CTYPE was correct there, but LC_COLLATE wrong.

Settings are the same as in Item3679

-- TWiki:Main/SergejZnamenskij - 23 Feb 2007

As discussed elsewhere, the fix is to do a similar setlocale call during initial TWiki.pm locale setup. Something like this should work:

    setlocale(&LC_CTYPE, $TWiki::cfg{Site}{Locale});     *setlocale(&LC_COLLATE, $TWiki::cfg{Site}{Locale});* 
-- TWiki:Main.RichardDonkin - 04 Mar 2007

Sergej. We clearly need someone with both knowledge and interest in i18n and perl to drive the development of TWiki in this direction. The regular developers do not seem to have the i18n knowledge that is requires.

Do you have SVN checkin rights Sergej? Otherwise you should apply and participate as a developer. Our developer community is not that large and there is room for much more to drive the development.

-- TWiki:Main.KennethLavrsen - 04 Mar 2007

Sergej doesn't have checkin rights, but is quite interested in doing I18N (see TWiki:Codev.InternationalisationGuidelines discussion) - I've emailed him to point to this page.

-- TWiki:Main.RichardDonkin - 05 Mar 2007

The fix committed for Item3652 included a line to set LC_COLLATE, so this should now be fixed - needs testing.

-- TWiki:Main.RichardDonkin - 11 Sep 2007

Current MAIN (r14866) doesn't seem to sort correctly for our locale here (I only tried sorting by clicking headers generated by TablePlugin).

-- TWiki:Main.SteffenPoulsen - 14 Sep 2007

That may well be a bug in TablePlugin - is it using locales properly as per the internationalisation guidelines (linked from I18N)?

The core sorting code using locales can be tested using WebIndex.

-- TWiki:Main.RichardDonkin - 30 Sep 2007

WebIndex sorts as it should here - excellent. Probably an item against I18N support for TablePlugin would make sense.

-- TWiki:Main.SteffenPoulsen - 30 Sep 2007

Reattributing to TablePlugin. Minor testcase (danish locale):

H1 H2 Correct H2 sort order, da locale
abc def 2
def abc 1
זרו ורז 4
ורז זרו 3

-- TWiki:Main.SteffenPoulsen - 22 Dec 2007

WebIndex does not sort correctly.

It consequently sorts ֶ״ֵ as ֵֶ״. Both in tables and in tables. Even when I define the locale as $TWiki::cfg{Site}{Locale} = 'da_DK.ISO-8859-1';

I noted the same problem in a Codev topic written by Richard about some perl lib that should be good for sorting. It did not know the Danish alphabeth either.

Either the locale setting sucks or the CPAN libs are buggy and have been for a long time.

-- TWiki:Main.KennethLavrsen - 29 Jul 2008

Sorting seems to work for me in unicode core. Closing.

-- CrawfordCurrie - 19 May 2015

ItemTemplate edit

Summary I18N: Sorting does not match locale settings
ReportedBy TWiki:Main.SergejZnamenskij
Codebase
SVN Range TWiki-4.1.1, Tue, 20 Feb 2007, build 12932
AppliesTo Extension
Component I18N, TablePlugin
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r13 - 19 May 2015, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy