1

I am trying to translate articles/nodes on my site. I installed all required modules. enter image description here

I have a custom node type.

enter image description here

This custom node type has some fields that are translatable and not translatable.

enter image description here

I checked this checkbox enter image description here

I created custom view for the front page that contains nodes of custom type. But when I switch the language translation doesn't work.

Menu translation works. But the view nodes are not translated.

The interesting thing that if I visit my node by a full url path like this

http://test.net/node/1

Translation works fine.

I am outputting node properties in my template in the following way

          {{ node.title.value }}
   {{ node.field_description.value|raw }}
    {{ node.field_custom_body.value|raw }}

What can be wrong ?

EDIT

I have no option Content language selected for page

enter image description here

My view looks like this now

P.S I am using language switcher block to change language and it sets the session variable

enter image description here

2

You have to configure a filter for the language in the the view:

FILTER CRITERIA

"Content: Translation language (= Content language selected for page)"


Btw. you have a big security problem in the node template, it is not allowed to apply the raw filter on a field that contains user input. You should use

{{ content.field_custom_body }}

instead to print the field.

  • Thank you so much for your help !! Appreciate it, but I have a problem I have not Content language selected for page, please see my edit – HelloMufecayo Mar 10 '17 at 13:26
  • You can use the interface language if you not have configured a content language. You can configure both separately, but you don't need to. – 4k4 Mar 10 '17 at 13:40
  • thanks, I've just set this option but when I change language I get an empty page ( (I've added configuration screen in my question) – HelloMufecayo Mar 10 '17 at 13:49
  • If you are sure that you have translated content which should pass all filters, then you have a problem with the language detection. I would start with only "URL" detection method enabled. – 4k4 Mar 10 '17 at 13:54
  • it works well, menu is translated, and single node url works well – HelloMufecayo Mar 10 '17 at 13:59

Your Answer

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

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