0

I have a View designed to filter down translated content (of type "Asks, Actions, and Updates") using three arguments: 1) country 2) year 3) month.

I have translated the content type and content, all three vocabularies and terms, and the View.

I want the URL to be readable, so the View has a relationship to the three vocabularies. I also have four "Translation language" filters, one for the content, which is being shown, and one each for the three vocabularies.

I also have three contextual filters that use the taxonomy "Name" and filter correctly in English with the following contextual filters entered into the preview:

burkina-faso/2018/july

English contextual filters

However, for some reason, the contextual filters do not work for French with these parameters:

burkina-faso/2018/juillet

French contextual filters

Interestingly, the following does work

burkina-faso/2018/all

French contextual filters with all

but when the last argument is 'juillet' (which is the French translation), it acts as through the name does not validate (no query shows in the preview section).

Why is this happening, and what can I do to have these filters work in both languages?

Here are images of the set-up of the third contextual filter: screenshot of the top of the contextual filter set-up screenshot of the middle of the contextual filter set-up screenshot of the bottom of the contextual filter set-up

5
  • Is "juillet" part of the taxonomy or is just a translation of the term "july"? And you might want show how the contextual filter for month is defined exactly.
    – hansfn
    Oct 30, 2018 at 12:37
  • Thanks. Yes, it is the translation of the term "July." I'll add the contextual filter images in the post.
    – andileco
    Oct 30, 2018 at 13:19
  • Maybe modify the question/title slightly as the problem isn't related to multiple relations? Does it even make sense to say that a view is translated? It's the content and taxonomy terms that are translated. I'm not trying to be difficualt - just trying to make the better question :-)
    – hansfn
    Oct 31, 2018 at 15:45
  • @hansfn, do you have any ideas? It works for the first two of the contextual filter, it seems like it's just the last one that fails. So that's why I was thinking it could be related to the number of relationships/filters. I have translated the View as well as the content.
    – andileco
    Oct 31, 2018 at 16:00
  • I have already answered the question with what I think is the solution/problem. (If the translation and the original text is identical, as for years, the validator works. I'm guessing if you test with a translated country name the view doesn't work even with English month names.)
    – hansfn
    Oct 31, 2018 at 17:19

2 Answers 2

1

OK, I had to play with this myself. The problem is the validator "Taxonomy term name" in the contextual filter. It doesn't accept the translated term name and hence no query is run.

My suggested solution is to remove the validator. AFAICT you get no matches ("page not found") for non-existing terms without the validator.

PS! I consider the non-working validator (for translated terms) a bug in Views.

5
  • By the way, I added patch #14 in order for terms like (Burkina Faso -> burkina-faso) to work. So yes, definitely some bugs with the term name validator.... Anyway, I'll give it a try as you suggested.
    – andileco
    Oct 31, 2018 at 13:28
  • Sorry, meant to include this link: drupal.org/project/drupal/issues/2710407
    – andileco
    Oct 31, 2018 at 13:44
  • when you say, "I consider the non-working validator (for translated terms) a bug in Views." do you know if there is an issue on Drupal.org? I haven't been able to find one. If not, I will create one.
    – andileco
    Nov 1, 2018 at 14:38
  • I didn't find one either so please create an issue :-)
    – hansfn
    Nov 1, 2018 at 18:15
  • Here! drupal.org/project/drupal/issues/3010929
    – andileco
    Nov 1, 2018 at 22:33
1

Not sure if there's anything else that could be configured.

Something you could consider is using something like hook_views_pre_view(). Internally then you can check the language of the site for that request, read the values of the month, and using a table, translate internally juillet to july.

2
  • Thanks for this suggestion. I may give it a try and will let you know how it worked.
    – andileco
    Oct 31, 2018 at 13:29
  • Sure this might be an OK solution for the month names, but not for translated terms in general. What I'm trying to say is that this isn't a general solution to the stated question.
    – hansfn
    Oct 31, 2018 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.