Language weights not working on nodes
acts238 - July 28, 2008 - 01:54
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | language system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
We have internationalised our site for 8 languages and would like to bring the flag icons into a certain sequence/order that remains the same no matter which language you have accessed. Any advice?

#1
Hey, I think this would be really good to look into for consistency on web pages especially those with multiple languages using the internationalisation module.
#2
+1 on this one. Keeping the order consistent and having control of that order is essential to a good user interface.
#3
@acts238: Setting oneself as "assigned" means that you have taken on writing a patch for this feature (or for answering the question on a support request). I'm guessing you didn't mean to do this, so I'm unassigning you. If you did mean to, feel free to re-add yourself. :)
#4
Agreed, would be good. How do we attack this? One of these "link_alter" methods?
#5
I don't know how or where to do it - it might not even be a task for Language Icons! I'll talk more with Jose about it when he returns home.
But I'm guessing the languages either have a weight or needs to be given us. And the interface to alter the order should obviously be this nifty drag'n'drop thingy that's used several places in core. =)
#6
Actually I think the function should be in core. The ordering of languages doesn't have much to with whether they have a flag attached or not. That said, probably the best way to get it into core is to get it working as a feature in this module and then they might want to commit it in the future. That also means we can have it working now, rather than waiting for D7!
#7
Actually... I just had a quick look in the database and noted that the "language" has a "weight" column. So I went to admin/settings/language and lo and behold! The language list actually has a "Weight" column there as well, which can be used to determine the language order. This order will be reflected in the language icon list as well.
So: issue solved. :) (This could be made drag'n'drop-able (in core) though, for increased shininess.)
#8
Hi Freso - thanks for unassigning this request :-) and for your comments. I have activated it again. The trouble is that in spite of setting the weight of languages to the desired order, the language icons at the bottom of each item are having a hay day and appear in whichever order they like - apart from the desired sequence.
#9
@acts238:
Could try and disable the Language Icons module and see if the order on the nodes is still the same? I'm rather confident that this is an issue with Drupal's core rather than Language Icons – as Drupal's core is what makes those listings; Language Icons just spice them up. :)
#10
Positive: disabling the language icon module does not affect the order of languages on the nodes. Any core solution hugely appreciated!
#11
Alright then, moving to core. And I'm sorry, but if using the weights does not help you, I can't help you further. :/
#12
I think that if there is a non-functioning weight system, then this is a bug report rather than support request.
#13
I agree. :) It should also be investigated whether this happens in Drupal 7 and than change the version accordingly. (The bug has a much greater chance of being seen and thus fixed, if it is listed where the current development takes place...)
#14
They seem to be ordered by nid (node id).
#15
Well, here's a temporary patch. This won't make the system respect the weights of the languages, but it will sort by "n.language" (ie., language code) instead of by node id, which means that at the very least, the language list order will be uniform across nodes. (And if they're all given the same weight, it will also be the same order as those in the language switching block.)
#16
Mine for tonight.
#17
Here is a proper patch.
#18
Ha. Well spotted. :)
Also, works as advertised; marking RTBC.
#19
Actually, I found one very minor nitpick on the patch:
"node/"should be'node/'. This shouldn't change anything in the functionality though, so I'm attaching a manually corrected patch and leaving the RTBC.Also, attaching a port of the patch for D6 - it's almost a straight port, just fixed some concatenation. (Also, it hasn't been tested.)
#20
The D6 patch worked for me. See it in action on www.cai.org. Well done and thanks guys.
#21
Committed to CVS HEAD and DRUPAL-6. Thanks!
#22
Also, if you're interested in improved niftyness when altering the order of languages, check #296197: Drag'n'drop language order. :)
#23
Automatically closed -- issue fixed for two weeks with no activity.