Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#19 | 287949_use_language_weight_on_nodes-19.d6.patch | 1.35 KB | Freso |
#19 | 287949-language-order-links.patch | 1.31 KB | Freso |
#17 | 287949-language-order-links.patch | 1.31 KB | Damien Tournoud |
#15 | 287949_uniform_translation_sorting.d7.patch | 942 bytes | Freso |
#15 | 287949_uniform_translation_sorting.d6.patch | 942 bytes | Freso |
Comments
Comment #1
tobyman CreditAttribution: tobyman commentedHey, I think this would be really good to look into for consistency on web pages especially those with multiple languages using the internationalisation module.
Comment #2
PixelClever CreditAttribution: PixelClever commented+1 on this one. Keeping the order consistent and having control of that order is essential to a good user interface.
Comment #3
Freso CreditAttribution: Freso commented@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. :)
Comment #4
fletchgqc CreditAttribution: fletchgqc commentedAgreed, would be good. How do we attack this? One of these "link_alter" methods?
Comment #5
Freso CreditAttribution: Freso commentedI 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. =)
Comment #6
fletchgqc CreditAttribution: fletchgqc commentedActually 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!
Comment #7
Freso CreditAttribution: Freso commentedActually... 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.)
Comment #8
acts238 CreditAttribution: acts238 commentedHi 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.
Comment #9
Freso CreditAttribution: Freso commented@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. :)
Comment #10
acts238 CreditAttribution: acts238 commentedPositive: disabling the language icon module does not affect the order of languages on the nodes. Any core solution hugely appreciated!
Comment #11
Freso CreditAttribution: Freso commentedAlright then, moving to core. And I'm sorry, but if using the weights does not help you, I can't help you further. :/
Comment #12
fletchgqc CreditAttribution: fletchgqc commentedI think that if there is a non-functioning weight system, then this is a bug report rather than support request.
Comment #13
Freso CreditAttribution: Freso commentedI 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...)
Comment #14
Freso CreditAttribution: Freso commentedThey seem to be ordered by nid (node id).
Comment #15
Freso CreditAttribution: Freso commentedWell, 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.)
Comment #16
Damien Tournoud CreditAttribution: Damien Tournoud commentedMine for tonight.
Comment #17
Damien Tournoud CreditAttribution: Damien Tournoud commentedHere is a proper patch.
Comment #18
Freso CreditAttribution: Freso commentedHa. Well spotted. :)
Also, works as advertised; marking RTBC.
Comment #19
Freso CreditAttribution: Freso commentedActually, 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.)
Comment #20
fletchgqc CreditAttribution: fletchgqc commentedThe D6 patch worked for me. See it in action on www.cai.org. Well done and thanks guys.
Comment #21
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD and DRUPAL-6. Thanks!
Comment #22
Freso CreditAttribution: Freso commentedAlso, if you're interested in improved niftyness when altering the order of languages, check #296197: Drag'n'drop language order. :)
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.