Problem/Motivation
Hello,
We are using i18nviews and the patch from Bart (see #1106294: exposed term with depth filter not translated) and it's working pretty good.
The only problem we have is that some terms are not ordered by their name when they are translated.
Exemple:
In french:
- Accoucheuse
- Dentiste
- Pharmacien
In Dutch:
- Vroedvrouw
- Tandarts
- Apotheker
Drupal will render the second list according to the order(weight) of the terms in the original language (which is french here) and it will be hard for the user to find terms in the list if they are not ordered.
Proposed resolution
The correct solution should be:
- Apotheker
- Tandarts
- Vroedvrouw
There is no 36 solutions to this problem, as we only have the weight to order elements, I've chosen to override it (for now) and order by the value of the option.
It means that ALL the exposed filters will be ordered in that way.
Maybe I'll try to insert an option to control it later, but for now I don't see how either where, ideas and improvements are very welcome.
Remaining tasks
Find a solution to enable the sort individually on each exposed filter.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1312074-Sort-exposed-translated-filters-by-their-val.patch | 1.41 KB | Pol |
Comments
Comment #1
PolHere's the patch for 6.x-2.x version.
Comment #2
Cyclodex CreditAttribution: Cyclodex commentedThanks for this patch, I used this as a base for a D7 and i18n_views 7.x-3.x-dev patch.
I have the same issue, but not related/using depth. I have a single level taxonomy list, and do exposed filtering on them. The problem is/was that the term list in a different language was ordered always like the "base language" as you also described in this issue.
The patch didn't worked, but I only had to add a none object comparison and I am also using
strnatcasecmp — Case insensitive string comparisons using a "natural order" algorithm
Otherwise lower-case terms are after upper-case ones.
I was mainly searching and trying to fix the list of terms when creating, but didn't got it working yet. This form_alter() was the only way I got a nice ordered list of terms in other languages.
If this is really a good way, I can post a patch if you like. But I will also ask for how we could fix this generally and not only with hook_form_alter()
Comment #3
Cyclodex CreditAttribution: Cyclodex commentedCan I move this to Version 7 or should I create a new issue related to this ?
I think because D7 is current Version and my code is related to this its fine, if not please change it back.
I only try to help ... ;)
I am also looking for other issues, and think we should fix this in general and not only with hook_form_alter().
Will also ask over here how / where we should fix this issue: #444732: translated taxonomy terms in alphabetical order
The code there is not working for me.
Regards Cyclodex
Comment #4
Cyclodex CreditAttribution: Cyclodex commentedDue this seems to be hard to better fix I just wanted to note, that I implemented some other hook_form_alter() to order all my select and checkboxes fields, finally I got a correct orderect list in a foreign language.
So the problem is done for me with this workaround.
Comment #4.0
Cyclodex CreditAttribution: Cyclodex commentedUpdated template.
Comment #5
epringi CreditAttribution: epringi commentedHi there, is there any change on this issue?
I'm having the same problem where the translated results are not sorted in the target language but in the originating language.
Cyclodex, if your patching worked, that would be great if you could share a patch file. :)
Thanks. :)
Comment #6
mas0h CreditAttribution: mas0h commentedI'm in the same boat