The issues was first documented here: http://drupal.org/node/634144.
I'm supplying the solutions provided here http://drupal.org/node/634144#comment-3096616 in a form of patch.
Goal
Use views to display the multi-lingual content as per website Language settings (admin/settings/language/i18n) that are set to
Content selection mode: Mixed current language (if available) or default language (if not) and language neutral
In my example, I have English and French content.
English is a default language.
Not all the content is translated to French so Views should display the content in the user selected language but if any node is not available in that language, show the content in the default language (in this case English).
Problem
Internalization (i18n) module has Views filter "i18n: Content negotiation" that is suppose to "Removes the nodes that are not valid according to the content selection mode".
Unfortunately, this is not working correctly because when viewing the page in French, both French and English nodes were displayed although there were a translation of each other and only French nodes should be visible because they existed.
Solution
Thanks to the posters in this thread, the solution presented in the patch below
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | i18n_6.x_fix_content_negotiation_Views_filter_patchp0.patch | 956 bytes | lolmaus |
| i18n_6.x_fix_content_negotiation_Views_filter.patch | 1.06 KB | kasiawaka |
Comments
Comment #1
YK85 commentedI think if the code in Select Translation module can be incorporated here, it will fix this issue and expand usage of the views filter in terms of multilingual sites
http://drupal.org/project/select_translation
Select translation implements a Views filter which allows you to select, for a group of nodes representing a same translation, which of the translation should be displayed.
The options are :
Use current language ; if not available use original language
Use current language ; if not available use default language ; if not available use original language
Provide a list of languages, so that the most appropriate language is selected. The list can contain the special values 'current', 'default' and 'original' for, respectively, the current language, the default language and the node's original language.
Comment #2
kirie commentedFixes the issue as advertised
Comment #3
kirie commentedBumping version number as well
Comment #4
lolmaus commentedI confirm the patch is working well!
I've only modified it to work with patch -p0 < blah command (removed the C:/... stuff).
Comment #5
alberto56 commented+1 the patch works. Thanks.
Comment #6
jose reyero commentedThe patch looks good. However, how it will work with some other non views queries or whether it will work for all DBs (pgsl?) is uncertain.
As I understand, there are some other modules addressing the issue, so we won't risk regression issues at this point (Drupal 7 coming)
Comment #7
JGO commentedHi,
We are now 2011, first reported this problem and fixed this over a year ago.
I don't see any other solution for this huge problem then applying this patch over and over with every update.
I think it's unacceptable that such a big bug is not fixed and patched in the main release :s
Comment #8
kasiawaka commentedUpdated the status to properly reflect that the patch is created but waiting to be ported to the module.
Comment #9
kasiawaka commentedSorry, my bad, didn't notice that maintainers actually marked this thread as closed and decided not to fix it.
Comment #10
miro_dietikerI think we should check the D7 version first and make sure this bug is fixed for future now.
Can someone please check and report the state of the D7 version?
Comment #11
klonos...subscribing.
@Jose, #6:
Care to share which ones? Are you referring to my workaround here perhaps?
Comment #12
klonos...btw I agree with the status change. This issue shouldn't simply be ignored.
Comment #13
jose reyero commentedThis 'mixed' option has been around for a long time and never working properly.
So: we are dropping it from i18n module.
Please, consider putting together a new module for complex content selection.
Comment #14
JGO commentedWTF are you crazy ? dropping support ??? pffff
Comment #15
klonosI agree. This is a serious issue for us people with multilanguage sites. It is not polite to simply ignore us. It should be decided if either Views or i18n is the proper place for it to be handled, but it does need to be handled. I do understand that figuring out a battle plan and finally coding a solid solution might be really hard, but all this "hiding the dust under the carpet" thing is not the way to go.
Perhaps we can agree on setting this to "postponed" then? Once we decide if this belongs to either i18n, Views, or some other contrib module, we can move this issue to the proper queue, but please do not close it.
Comment #16
jose reyero commentedOk, "postponed", then.
Anyway, just to make it clear, if we want a stable i18n release, incomplete features that break other modules' queries cannot be there. I think adding this never fully working query rewriting was a mistake in the first place, and so far has consumed a huge amount of time from everybody.
Moreover, there's no reason why this needs to be integrated into i18n. Any other simple module could do it even easier as it doesn't need to handle different 'selection' options. Just disable i18n_select, enable the other module. Also "Select Translation" or "i18n views" would be much better candidates for this feature.
Note D7 i18n_select has an option for not rewriting views queries at all, that is enabled by default (skip tags 'views'). Maybe that should be hardcoded.
Comment #17
lolmaus commentedCome on, there's a tested-and-confirmed patch already! Have you even tried it?
Comment #18
nor4a commentedSubscribing
Comment #19
jose reyero commentedThis was a 6.x issue so changing version.
About this feature, it has many other problems including serious performance issues.
The patch includes subqueries and it is complex and runs for all views and non views queries. Also it would fit better as a views filter or on other modules (i18nviews, select_translation).
For the 6.x version our #1 priority is not breaking exsiting sites. About patching don't worry that much because there won't be many more 6.x releases.
So just "it fixes my views issue" is not enough here. There are many other hundreds of different node listings provided by other modules.
Comment #20
jose reyero commentedPlease see #1252494: Create a new module for complex query altering (mixed mode) language selection.
Comment #21
joseph.olstad