In a twig template you are able to get a relative path by using {{ path('entity.node.edit_form', {'node': nid }) }}. The result path will be in current language.

If you need to get the path in a specific language, you could use {{ path('entity.node.edit_form', {'node': nid }, {'language': language }) }}. But the value of language has to be a language object. Therefore you need to create the language object in a preprocess function and make it available as a twig variable. This is very unhandy, especially if you use twigs path function in a userdefined views view field.

I suggest to allow a language code like DE or EN as an option for twigs path function. What do you think about this?

Comments

pminf created an issue. See original summary.

joelpittet’s picture

That sounds like a great idea. Want to put together a patch?

dawehner’s picture

joelpittet’s picture

Status: Active » Closed (duplicate)

That looks like a duplicate to me, thanks for spotting that @dawehner

Unless the author wants to take a different approach let's try to help that issue.