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

tobyman - July 29, 2008 - 05:52

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

Aaron Hawkins - August 9, 2008 - 14:39

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

#3

Freso - August 11, 2008 - 08:51
Title:sequencing language icons» Ordering language icons
Component:User interface» Code
Category:support request» feature request
Assigned to:acts238» Anonymous

@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

fletchgqc - August 11, 2008 - 16:33

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

#5

Freso - August 11, 2008 - 16:54

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

fletchgqc - August 11, 2008 - 17:55

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

Freso - August 11, 2008 - 19:10
Category:feature request» support request
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.)

#8

acts238 - August 12, 2008 - 04:39
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.

#9

Freso - August 12, 2008 - 07:24
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. :)

#10

acts238 - August 12, 2008 - 12:59

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

#11

Freso - August 12, 2008 - 13:12
Project:Language Icons» Drupal
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. :/

#12

fletchgqc - August 13, 2008 - 08:16
Category:support request» bug report

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

#13

Freso - August 13, 2008 - 08:28
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...)

#14

Freso - August 13, 2008 - 13:44
Version:6.x-dev» 7.x-dev

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

#15

Freso - August 13, 2008 - 14:00
Status:active» needs work

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

AttachmentSize
287949_uniform_translation_sorting.d7.patch 942 bytes
287949_uniform_translation_sorting.d6.patch 942 bytes

#16

Damien Tournoud - August 13, 2008 - 16:00
Assigned to:Anonymous» Damien Tournoud

Mine for tonight.

#17

Damien Tournoud - August 13, 2008 - 17:52
Assigned to:Damien Tournoud» Anonymous
Status:needs work» needs review

Here is a proper patch.

AttachmentSize
287949-language-order-links.patch 1.31 KB

#18

Freso - August 13, 2008 - 18:58
Status:needs review» reviewed & tested by the community

Ha. Well spotted. :)

Also, works as advertised; marking RTBC.

#19

Freso - August 13, 2008 - 19:07

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

AttachmentSize
287949_use_language_weight_on_nodes-19.d6.patch 1.35 KB
287949-language-order-links.patch 1.31 KB

#20

fletchgqc - August 15, 2008 - 12:45

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

#21

Dries - August 16, 2008 - 21:38
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD and DRUPAL-6. Thanks!

#22

Freso - August 16, 2008 - 22:42

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

#23

Anonymous (not verified) - August 30, 2008 - 22:42
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.