Closed (fixed)
Project:
Flag
Version:
6.x-1.1
Component:
Views integration
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Aug 2009 at 10:20 UTC
Updated:
8 May 2010 at 21:26 UTC
I have a site with 3 languages: English, French and Dutch.
Only the node id of the source language (English) is flagged. The IDs of the translated nodes (French and Dutch) are not.
As a result I only see the titles of the English nodes in my view. Normally I should see a node title for each translation and by using a views filter only the ones that correspond with the current user's language, are shown.
However the flag status is correct when I change the user interface language, for example: when I flag a node using the English interface, it is shown as flagged using other languages and vice a versa. So this works fine.
Comments
Comment #1
tomsm commentedI don't know if this issue is related to the flag core or views integration. But I have the problem with views, so I pick that one.
Some extra info:
I have set my internationalization option to "Flag translations of content as a group".
Comment #2
vanhanit commentedI too have this problem.
The join for me created by Views is:
For multilanguage support this should be something like:
or
After this one can filter the result down with the Select Translation module.
I have tried to fix this problem myself but can't really find any good documentation on how Views Integration works from a developers perspective.
Comment #3
quicksketchI don't think this is a problem with the Views integration, it's probably a matter of setting up the view properly. When you tell Flag to "flag translations as a group", it actually only flags the original node, not any of the translations. So when building a view that lists nodes in any language, you will need to add another relationship for finding the parent translation, then do all your flag filtering/relationships off of the parent translation.
Comment #4
tomsm commentedThanks for the tip. I have found a solution:
I added the relationship "Node translation: Source translation" with as label "Source translation".
I placed it above the existing flags relationship and set its relationship to "Source translation".
The result is that all translations are shown in the view.
Then I added a filter "Node translation: Language = current user's language".
Is this the best solution?
Comment #5
quicksketchYep, sounds perfect. I haven't worked on any internationalized websites recently, but that sounds like the same approach I used in previous sites.
Comment #6
tomsm commentedSmall problem:
If I flag a node that has not been translated yet (only the source language English exists), it does not appear in the view.
If I translate it in one language, the node appears in the view when the interface language = source and = translated language; if the interface language = not translated language, the node does not appear, which seems normal.
Comment #7
quicksketchYou should check if that node doesn't show up even without the Flag relationship/filters added to the view. My guess is that the the translation relationship isn't pulling in the nodes correctly if it hasn't been translated.
Comment #8
tomsm commentedWhen I uncheck "Include only flagged content" in the flag relationship, the untranslated node is shown. So the translation relationship is pulling the node. If I recheck "Include only flagged content" the node disappears again.
When I remove the flag relationship I get an error message "An error occurred at /drupal/en/admin/build/views/ajax/preview/flag_favorite_products."
Comment #9
vanhanit commentedI have solved this by extending views_join with my own class and added the IN join i described above. After that I use the Select Translation module to filter down the result to the best matching node language according to the logged in user.
Comment #10
quicksketchClosing after lack of activity.