I am trying to get the Views Module to filter output like the i18n Module's new option for content selection: "Mixed current language (if available) or default language (if not) and language neutral." This is how I have always wanted the language selection to work, so that nodes that are translated appear in their translated version, and nodes that are not yet translated appear in the default language.

How do I tell the Views Module to filter like this? i18n handles it automatically when I search for a taxonomy term, but when I try to replicate that search with the Views Module, i18n no longer works its magic.

I am using the latest versions of Drupal, the Views Module, and i18n.

Comments

jno84’s picture

So...up

wowik73’s picture

I use in views.

Filter 1 variant:
Node translation
- WHERE (node.status <> 0) AND (node.type in ('XXX')) AND (node.promote <> 0) AND (node.language in ('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***', '***NO_LANGUAGE***'))

Filter 2 variant:
i18n: Content negotiation
- WHERE (node.status <> 0) AND (node.type in ('XXX')) AND (node.promote <> 0) AND (node.language ='en' OR node.language ='ru' OR node.language ='' OR node.language IS NULL)

Result - node in all language.

Not Work!

I can work this - rewrite function function i18n_db_rewrite_where:
return "$alias.language ='$current' OR (($alias.language ='$default' OR $alias.language ='' OR $alias.language IS NULL)".
" AND NOT EXISTS (SELECT nid FROM ii WHERE ii.language='".i18n_get_lang()."' and ii.tnid=$alias.tnid))" ;