Hi,
currently mixed mode only supports selecting nodes in Current and Default languages. Isn't this limiting?
Could this be improved to select also nodes in other languages (like mode 'off' does), still avoiding duplicates when a node has several translations?
I am designing a multi-lingual blog, which could support many languages, but only some nodes will have translations (either in only some or all defined languages).
Ideally on front page I would like to show content also in languages other than current or default (which should not be special from a user point of view) so the rules I would like to use to display content on front page would be as follow:
- Iterate though all nodes to display on front-page (as per Content Selection = off)
- If a node has a translation in current language show this one and discard other translations
- If a node has not a translation in current language but it has one in default language, use the latter and discard other translations (not sure about that, IMHO users should not care what the default language is)
- If a node has translations but neither in current (or default language), pick the first translation and discard the others
- If a node has only one translation, just display it
- If a node is language neutral, display it.
You query gurus can express that declaratively and more simplified, but I showed it this way hoping to show my idea more clearly.
I have still to research how to do what I am asking with Views, but the description above could well match a naive definition of "mixed mode" that's why I am posting here first. Any comments?
Regards,
Antonio
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | i18n_mixed_single_d6_v02.patch | 2.45 KB | ao2 |
| #1 | i18n_mixed_single_d6_v01.patch | 2.65 KB | ao2 |
Comments
Comment #1
ao2 commentedHi,
it looks like this kind of request is quite popular :) I found similar ones #203798: Preferred language option and #78973: List translated nodes without duplicates, in particular, the latter asks pretty much what I am also asking.
I ported the patch from #78973: List translated nodes without duplicates to i18n-6.x-1.0, which I am attaching here.
It works for me on frontpage, but I would like to hear what do you think about it.
Waiting for comments...
Regards,
Antonio
Comment #2
ao2 commentedmmh, maybe we can use
UNIQUE(tnid)after ordering the nodes instead of using a subquery?Regards,
Antonio
Comment #3
ao2 commentedWell, as dereine pointed out in #434308: Filter duplicate translations, the
UNIQUEway can't work because nodes without translations are all in the same translation group withtnid=0.So, the query I am searching for should really be this one:
Which I find more readable than the old one I copied from mardy78.
I attach here an updated patch, please let me know if you find it suitable for inclusion, in that case we could find a better name than "mixed_single" which I don't like too much.
Regards,
Antonio
Comment #4
ao2 commentedOk, the Active Translation module does basically what I am looking for, and I also found the solution for Views in the Select Translation module.
I am leaving the issue open and changing the target to HEAD, maybe you can add this content selection mode to D7 so an external module would not be needed anymore for a such fairly requested feature.
Thanks,
Antonio
Comment #5
drewish commentedPersonally I'd just mark this as fixed and suggest people use the Active Translation and Select Translation modules but I'll leave that up to the i18n maintainers.
Comment #6
jarizaro commentedWaiting for a solution for this too... I need to select in the views, content in the user language, and if itsn't available , then default language.
Comment #7
drewish commentedjarizaro2, well you can always grab active translation and then try out this patch #516918: View 2 integration
Comment #8
ao2 commentedIf you use Views the Select Translation module should be ok for you. It solved the issue perfectly for me and without using an additional table in the DataBase as Active Translation does.
Comment #9
jose reyero commenteddrewish> Personally I'd just mark this as fixed and suggest people use the Active Translation and Select Translation modules but I'll leave that up to the i18n maintainers.
Right, I think it's the best option.
Also I'm working on some more flexible query rewriting options so this should be a pre-requiste for any other related improvement #364001: Improve query rewriting and content selection: options, parameters, fine tuning