|
|||
| Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius |
|
|||||||||||||
| Ordering of Items - Wish list for software localization tool - Technical Support (You need to be registered at the forum to write) - Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... | ||||||||||||||
| Author | Post | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
mdunmill Member
|
Would it be possible to change the sorting of items to use a Natural/Logical sort order rather than a lexical sort order. See StrCmpLogicalW Function http://msdn.microsoft.com/en-us/library/bb759947(VS.85).aspx i.e. Instead of sorting in the following order
would sort as The function StrCmpLogicalW also handles the mixing of characters and digits to produce a 'natural' sorting order. e.g. is sorted as
This would real help in being able to see ranges of strings etc. since now they can easily be spread right through the tree or list control whereas with the appropriate natural sort order they would be grouped logically.
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Ilkka.Salmenius Administrator
|
There is a problem. Right now we are using the CompareStringW function. It can be parametrized by a locale (language). It is important in many languages. In StrCmpLogicalW function there are no locale parameters. But I will study this possibility more.
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Ilkka.Salmenius Administrator
|
I can implement my own natural string comparing routine that uses CompareStringW function. I will implement it in the near furure.
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
mdunmill Member
|
Yeah, I was a bit worried that there may be other issues. However, I don't think the basic algorithm would be too hard to implement yourself. I'm not 100% certain, but I think all that happens is that each string is broken up into homogeneous sections consisting of parts made entirely of digits or entirely of non-digits. The sections from 2 strings are then compared in order. If a section consists entirely of digits then a numeric comparison is done. For two non-digit sections then a straight lexical comparison is done. If a comparison between digits and non-digit sections then return the digits as coming first. Sections are compared in turn until a difference is found. I think this approach would allow locale sorting rules to be obeyed and should be able to be implemented in Delphi etc. One of the only issues may be the right-to-left languages, but I'm not sure. Another issue would be the handling of arbitrary length digit strings without overflowing. (Can skip leading zeroes etc. in both strings and then return the shorter of the two strings - if the remaing digit strings are the same length then do a lexical comparison - if the strings are equal then return the one with the shortest number of leading zeroes). (Note: numbers with decimal points, be they commas or periods, won't sort strictly numerically but that is ok - I think!?!)
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Ilkka.Salmenius Administrator
|
I implemented it (like you suggested). Will be in the next build. regards Ilkka
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| Current time is 04:06 am | |
| Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... > Technical Support (You need to be registered at the forum to write) > Wish list for software localization tool > Ordering of Items | |
Sisulizer software localization tool - Three simple steps to localize