Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Get translation of page.title for present page

Started by Joachim Liedtke 8 years ago · 3 replies · 903 views
8 years ago

Scenario:
On my English version of a page I would like to insert the German translation of the 'page.title' (or any other header information) dynamicaly via Twig variable.

How can I access the 'page.de.md' header information while being on the English version?

8 years ago

Found a solution myself:

To access a certian translation you would do something like this: {{ page.title|tl(['de']) }}

Hope that helps anybody.

last edited 04/16/18 by Joachim Liedtke
8 years ago

The above mentioned solution is not working. Still looking for something working ... :o/

8 years ago

Perhaps if you add the language of every page in it's header or frontmatter and create a collection, you could use some Twig logic to filter and get the desired page title?

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 11 months ago
6 935 11 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 741 1 year ago
Content & Markdown · by Jan L'Am, 2 years ago
4 662 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 588 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 965 2 years ago