Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

How to output all values from a translated list?

Started by Jared 8 years ago · 2 replies · 576 views
8 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?

8 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 Jerry Hunt, 4 days ago
2 99 16 hours ago
General · by pamtbaau, 21 hours ago
1 63 21 hours ago
General · by Andy Miller, 1 day ago
0 48 1 day ago
General · by Marcel, 12 months ago
6 357 5 days ago
General · by Duc , 6 days ago
3 45 6 days ago