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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tobyman’s picture

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.

PixelClever’s picture

+1 on this one. Keeping the order consistent and having control of that order is essential to a good user interface.

Freso’s picture

Title: sequencing language icons » Ordering language icons
Component: User interface » Code
Assigned: acts238 » Unassigned
Category: support » feature

@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. :)

fletchgqc’s picture

Agreed, would be good. How do we attack this? One of these "link_alter" methods?

Freso’s picture

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. =)

fletchgqc’s picture

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!

Freso’s picture

Category: feature » support
Status: Active » Fixed

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.)

acts238’s picture

Status: Fixed » Active

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.

Freso’s picture

Status: Active » Postponed (maintainer needs more info)

@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. :)

acts238’s picture

Positive: disabling the language icon module does not affect the order of languages on the nodes. Any core solution hugely appreciated!

Freso’s picture

Project: Language Icons » Drupal core
Version: 6.x-1.x-dev » 6.x-dev
Component: Code » language system
Status: Postponed (maintainer needs more info) » Active

Alright then, moving to core. And I'm sorry, but if using the weights does not help you, I can't help you further. :/

fletchgqc’s picture

Category: support » bug

I think that if there is a non-functioning weight system, then this is a bug report rather than support request.

Freso’s picture

Title: Ordering language icons » Language weights not working on nodes

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...)

Freso’s picture

Version: 6.x-dev » 7.x-dev

They seem to be ordered by nid (node id).

Freso’s picture

Status: Active » Needs work
FileSize
942 bytes
942 bytes

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.)

Damien Tournoud’s picture

Assigned: Unassigned » Damien Tournoud

Mine for tonight.

Damien Tournoud’s picture

Assigned: Damien Tournoud » Unassigned
Status: Needs work » Needs review
FileSize
1.31 KB

Here is a proper patch.

Freso’s picture

Status: Needs review » Reviewed & tested by the community

Ha. Well spotted. :)

Also, works as advertised; marking RTBC.

Freso’s picture

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.)

fletchgqc’s picture

The D6 patch worked for me. See it in action on www.cai.org. Well done and thanks guys.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD and DRUPAL-6. Thanks!

Freso’s picture

Also, if you're interested in improved niftyness when altering the order of languages, check #296197: Drag'n'drop language order. :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.