Drupal - Link to content in views doesn't translated to fr
One way to solve this would be to construct the "Link to content" field on your own, using Views. You will need to:
- Add 2 fields to your view:
- a "Content: Node ID (Node ID)" field
- a "Content: Translation language (Translation language)" field.
- Exclude the "Content: Node ID" field from display.
- Rewrite the "Content: Translation Language" field as a custom link.
The text in the "Rewriting" would look something like this:
Link path: {{ langcode_value }}/node/{{ nid }}
Hope this helps!
Until the core issue gets resolved here is a SIMPLE workaround that produces aliased URL
- add ID as field and exclude from display
use the following code whereever you want the translated node url
{{ path('entity.node.canonical', {'node': nid}) }}
it seems to be a bug in Drupal 8.3 views module at the time
but based on @Stefanos answer I suggest using Content: Path
field and then exclude it from display, following Stefanos answer instead of:
Link path:
{{ langcode_value }}/node/{{ nid }}
you can just try {{ path }}
it's better this way just too keep your URL aliases working