I have a multilingual D7 site. I have a fairly complex language hierarchy setup with 10 languages set up besides the default English. We are using the Language Hierarchy module so that we can specify fallback languages if content is not translated or doesn't need to be translated. That way pages will still show up in all languages and will default all the way back to the English version if need be. This all works great and is doing exactly what we want.

Now it's time to create a view to display certain content and I am having an issue where I do not want to show certain content in the view to certain languages, but to complicate things it is also based on if a field value is a certain value.

So this is a custom content type I am talking about called "Case Studies". Each case study has an "Industry" field which denotes which industry the case study is for. There is a requirement that we not show certain industry case studies to certain countries/languages, as they do not apply. So, for example, we have a language/country code for "nl-BE" which is Dutch as spoken in Belgium. So if that language code is in the URL, they get the Belgium version of the site and they would get the translated into Dutch case studies on the case study listing page (the view). That is all working correctly. But now we do not want certain industry case studies to show up for the Belgium language code. Basically, "If the industry is X, do not display the case study on the case study listing page for the nl-BE language code." I've been looking at the filters and I just don't see any way to do this since it is based on the value of a field AND the language code in the URL. I can't really use the "Language the content is in" filter because we are using the language hierarchy module, so that might not be accurate. It should be based off what the current users language selection is on the site as a whole. In other words the code in the URL.

Any help?

  • 1
    It's really difficult to predict the outcome without trying out that module. What happens in your views when you add the node language field? Which language is it showing? Can you post relevant screenshots of your Views? The URL lang prefix controls the interface lang, content lang negotiation is separate. What happens if you filter views with the lang filter to show according to the interface language? – prkos Aug 30 at 19:06
  • OK, so I actually went a different route and I think this will work. Instead of trying to beat the one view into submission to handle all cases, I simply cloned the block view and changed the parameters there. So now I have a default block view that shows everything and then a copy of the block view that filters out the specific industry. Then I can use the language block functionality when I am placing the blocks to choose which languages show which block. This seems to be working as I want it. – Erich H. Aug 30 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.