Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

Get translation of page.title for present page

Started by Joachim Liedtke 9 years ago · 3 replies · 993 views
9 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?

9 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
9 years ago

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

9 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, 12 months ago
6 1324 12 months ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1052 2 years ago
Content & Markdown · by Jan L'Am, 2 years ago
4 917 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 840 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1270 2 years ago