1

In D8, I have a website set up with 5 languages, using file path, like so:

 website.com/en/link
 website.com/en-us/link
 website.com/fr-ca/link
 etcetera.

I've made a view of blogs and resources. It includes a filter to current language selected for page and Not Specified-- this is to include articles that are intentionally set to Not Specified, so they show up for ALL languages. ( I don't want to have to turn 1000 blog posts into 4000 duplicates)

Problem is, the view is showing the link to items ONLY in the default language (EN) Regardless of what language I view the website in.

I'm using a hidden "Link to Content" field within a custom field for each item. I've UNchecked 'use absolute url'. I'm not sure what else to do. It doesn't make sense to me that it would be ignoring the site's current language.

If it's relevant, the link within the custom field is written like this:

 <a href="{{ view_node }}?title={{ field_file_name }}&type={{field_resource_type}}">{{ title }}</a>

I also added in a "Content: Translation language" field, to verify I was looking at the correctly filtered language. the URL uses default language regardless of whether the item's language is specified or not.

Update: I've also ensured the bottom middle column in Views is set like this:

 Rendering Language:Content language selected for page

This did not solve the problem. As a further test, I've also unchecked 'not defined' in my filter. While filtering to only nodes of the current language selected for page, I Still get URLs to the default language.

Also, the view has been translated into all relevant languages. Not sure how to change how the {{ view_node }} renders though. I assume it should be programmically pulling the current language when generating a URL. This {{ view_node }} is where the language is appearing. It seems like it should not be, though. The node alias shouldn't contain the language, I thought.

6
  • In the middle column of views UI go to section LANGUAGE and set Rendering Language:Interface text language selected for page - this will link to the current language IF that entity exists in that language. Non-translated entities don't own a translated link, they will always point to the original language.
    – Hudri
    Commented Dec 16, 2019 at 18:06
  • @Hudri I've changed this setting - but still no luck. Even translated items are still generating the default language link. Side note - if unspecified nodes will always send a user to the default language, I may need to determine a way to manually generate the urls using positions?
    – turpentyne
    Commented Dec 16, 2019 at 18:12
  • Have you translated the views page? If you filter for current language selected for page, you need a translation of the views page itself too.
    – Hudri
    Commented Dec 16, 2019 at 18:18
  • @Hudri - yes. The view is translated, but there's no place to modify. If I expand the custom field in the views translation, it's still just "<a href="{{ view_node }}?title={{ field_file_name }}&type={{field_resource_type}}">{{ title }}</a>" which generates the default language. I don't know how to customize that {{view_node}} piece. It's just a token, even within the views translate page. So, I have nothing to translate - assuming I've understood?
    – turpentyne
    Commented Dec 16, 2019 at 18:37
  • @Hudri oh, wait.. I just caught something in what you said there: 'views page' . this is a views block set into another page. I wonder if I need to translate the block as well. Going to try that now.
    – turpentyne
    Commented Dec 16, 2019 at 18:55

1 Answer 1

0

After narrowing down the issue, I think I've stumbled into an actual existing, known issue: Entity Links fields does not have translation support.

https://www.drupal.org/project/drupal/issues/2877994

I still need to figure out how to apply a patch, but I suspect this is actually a duplicate of the above issue.

1
  • No patch needed, the latest Drupal version is fixed.
    – 4uk4
    Commented Dec 17, 2019 at 21:19

Your Answer

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

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