I created a patch to address the following issue:

We're using the "Node: Select translation" filter along with “Published: Yes” in a view. Each node in the view's result set has a Japanese translation in addition to the original/default language of English, but some of the Japanese nodes are unpublished. So, if the user’s current language is Japanese, the “Node: Select Translation” filter chooses the Japanese node because it exists, but “Published: Yes” filters it out because it’s not published. Thus, nothing gets displayed for those translation sets.

The behavior we want is: if the user's current language is Japanese, the filter should not select the Japanese node if it is unpublished. The English node (assuming it's published) should be displayed instead.

The attached patch gives us the option of having that behavior. As shown in the attached screenshot, it adds a checkbox to the views filter that says "Select the translated node only if it is published." If you do not check that box, then the module's behavior is unchanged.

Comments

surgeonbor’s picture

Oops, here's the patch in the proper format.

ao2’s picture

Issue summary: View changes

@surgeonbor The option seems to be there in D7 and D8 version of select_translation. Can you test if it still works fine? In my tests it does not seems to work as documented but maybe I am missing something.

Thanks,
Antonio

ao2’s picture

Component: Miscellaneous » Code
ao2’s picture

Version: 6.x-0.x-dev » 8.x-1.x-dev
Status: Active » Closed (duplicate)
Related issues: +#2321053: Fall back to site default language when a translation is unpublished

OK, now I realize that the option I was talking about is #2321053: Fall back to site default language when a translation is unpublished.

The fix for #2321053: Fall back to site default language when a translation is unpublished should cover the use case illustrated in this issue, so I am closing this one as a duplicate.

AFAICS the option assumes that the view have also the "Published (=yes)" criterion, otherwise it will show both the unpublished node and the published one in the default site language.

I tried to improve the documentation to clarify this assumption, see 865732c.