ZenphotoCMS Forum
Alphabetical sorting for different locale, possible? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Alphabetical sorting for different locale, possible? (/thread-7323.html)



Alphabetical sorting for different locale, possible? - Wahyaohni - 2010-07-09

Hello, my tattoo site is using dynamic locale for czech and international visitors. I'm having album directories in english and so in english "version" they are sorted correctly (like "american, ankle, back, celtic .. etc.), but switched to czech, the sorting looks like .. kind of "completely unsorted" ;-)

I'm wondering if there's a way how to sort albums custom by language. It doesn't need to rely on dynamic locale, just the different locale, as I'm thinking now.

Any ideas please?

As I do research, it could be somehow done by selecting TITLE from albums SQL table, as follows example: "a:3:{s:5:"cs_CZ";s:6:"anděl";s:5:"en_US";s:5:"angel";s:5:"nl_NL";s:5:"engel";}"

but before I start coding my "patch", as I'm not very skilled coder, isn't there any other solution?

Many thanks
Filip




Alphabetical sorting for different locale, possible? - acrylian - 2010-07-09

You can sort by title. I suggest you try the current release first before trying anything since you are using 1.2.8.

If you think sorting does not work correctly with 1.3 as well please open a ticket.

Besides if you are using the multilingual you can't sort by a query using the title field as that is serialized (as you posted).




Alphabetical sorting for different locale, possible? - Wahyaohni - 2010-07-09

Wow, it's working now. I found the menu option and had it set right. The confusion was made probably by czech translation where one was "name" and second was "title". This is great, it makes the gallery much more clean, sorted now ;-)

Anyway I'm having another issue to solve now - it put's diacritical beginning characters in front of all instead of where it belongs.

But I understand this is regional issue. Anyway any idea how to solve it by hardrecoding somewhere?

Thanks
ps: I'm going to upgrade to 1.3 asap, just have to make some backups and testing, etc.




Alphabetical sorting for different locale, possible? - sbillard - 2010-07-10

There are some issues with sorting strings with some diacritical characters. I am afraid we do not yet know of a solution to the issue. Seems not to be a sort that does both "natural" order and handles diacritical characters.




Alphabetical sorting for different locale, possible? - Wahyaohni - 2010-07-10

I'll try to do some research about this, as in my language this must have been solved elsewhere for sure. To make it easier for me, can you point me to the section of code (which file?) where this sorting is being done?




Alphabetical sorting for different locale, possible? - sbillard - 2010-07-10

There is a function named sortByMultilingual() in functions.php which is used for the title sorts. However, there are other places where this solution would be needed--for instance, sorting the Tags. There is a parameter for normal sorts, SORT_LOCALE_STRING that handles this, but with these sorts, numbers are not sorted the way people expect. (Orders end up like 1,10,2,3...)




Alphabetical sorting for different locale, possible? - Wahyaohni - 2010-07-10

Ok, I'll try to do some research and local consultations about this.




Alphabetical sorting for different locale, possible? - Wahyaohni - 2010-07-11

Good news everyone. Solved ;-)

This function used after natcasesort on $temp make it right for czech language. Unfortunately this is language specific.

btw. in my case I had to alter one of the last lines to while ($charA !=); (which makes this part of code disabled kind of) because it gave me some error I could'nt solve but make this work at all.

As for the comments if you need, put it into google translate and you should be fine.




Alphabetical sorting for different locale, possible? - Wahyaohni - 2010-07-16

So, how do you feel about this? Is it any help for development or just "patch" for czech language to work? (any reply to let me know pls)




Alphabetical sorting for different locale, possible? - sbillard - 2010-07-17

Well, since this is language specific, it is not something that we will incorporate. we would really like a general solution, but so far, none has surfaced.