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

How to output all values from a translated list?

Started by Jared 9 years ago · 2 replies · 731 views
9 years ago

Hi
I've got an array of words in my translation file but I want to display all the values on the page not just one. How do I write the for loop in twig?

YAML
en:
  homepage:
    wordlist: [January, February, March, April, May, June, July, August, September, October, November, December]

I want all the months to output so I tried things like

{% for word in homepage.wordlist[grav.language.getLanguage] %}

but get nothing back. Any idea what the syntax is?

9 years ago

Hi
Yes I can pull out individual values but how do I get all months returned not just one specific one?
{{ ta('MONTHS_OF_THE_YEAR',3) }} is fine for March but I'm stumped getting them all.

Suggested topics

Topic Participants Replies Views Activity
General · by jeremycherfas, 1 week ago
5 196 5 hours ago
General · by lynbor, 6 days ago
2 130 3 days ago
General · by Old Man Umby, 1 week ago
1 103 1 week ago
General · by Sebastian, 2 weeks ago
1 128 2 weeks ago
General · by Andy Miller, 3 weeks ago
0 251 3 weeks ago