Problem/Motivation
On a multilingual website:
- Create an article with a tag, for example in english
- Translate the article in french and do not associate the french version with the tag.
- Go to the tag page in english
- See your article in english: OK, normal
- Go to the tag page in french
- See your article in french: KO, the french version of the article is not associated with the tag
The problem is due to the taxonomy_index table, the langcode of the node is not stored. So when the contextual filter "Content: Has taxonomy term ID" make a relationship on the table, it includes the node in all the languages.
Proposed resolution
I don't know how the clean way to solve this and as I need something working quickly I made a workaround. I will upload a patch (with a hook_update_n starting at 8300 to not be incompatible with further merged hook_update_n).
The idea is to add a "langcode" column to store the langcode of the node in which the taxonomy term is referenced.
Then adding a new view filter on this column to be able to filter the results to avoid duplication.
Remaining tasks
- Code / idea review
- Needs tests
- Needs proper update path
User interface changes
A new view filter is created: "Taxonomy term: Node language"
Data model changes
Column "langcode" added to taxonomy_index and "langcode" added to the primary key and the ndexes of the table.