Site configuration:

* i18n preferred language selection mode
* english and 3 other languages

Problem:

In preferred language selection mode on a non-english section, nodes don't show up in a listing although there is no translation for them in the current language.

Reason:

#Example query
SELECT node.nid, i18n2.nid as i2nid, i18n.trid, node.title, i18n.language
FROM node node 
LEFT JOIN i18n_node i18n ON node.nid = i18n.nid 
LEFT JOIN i18n_node i18n2 ON i18n.trid = i18n2.trid AND i18n2.language = 'pt-br'
WHERE (i18n.nid IS NULL OR i18n.language ='pt-br' OR (i18n.language ='en' AND i18n2.nid IS NULL)) 
AND ( (node.type IN ('event')) AND (node.status = '1') );

When this query tries to join through trid, it also uses trid = 0 - the trid for nodes without any translations. This way the query finds other _untranslated_ nodes with trid = 0 and mistakes them as a matching translation in the current language. This in turn excludes the node from the list, because we are only looking for nodes in the current language plus such that don't have a translation in the current language.

Proposed solution:

Add a 'i18n.trid != 0' to the JOIN clause so that only joins through non 0 trids are valid.

CommentFileSizeAuthor
#1 337501_preferred_mode_fix.patch843 bytesalex_b

Comments

alex_b’s picture

Assigned: alex_b » Unassigned
Status: Active » Needs review
StatusFileSize
new843 bytes

Patch. Implements the solution above.

jose reyero’s picture

Status: Needs review » Closed (won't fix)

See #626858: Internationalization 5.x Maintenance Policy. Approaching end of support..

@alex_b,
You can commit yourself if you still need that.