To use "Now.Year" inside a YAML translation and it returns "no-value"

Hello,

I am using YAML instead of TOML. Here is the small code of a file called en.yaml:

- id: footer_copyright
  translation: "© 2019-{{ .now.Year }} Suru++ Folders by Gustavo Costa and Andrea Bonanni. All Rights Reserved."

And in a HTML file:

<p>{{ T "footer_copyright" }}</p>

I also tried all the codes with How do I display the current year?, but no luck.

Try:

- id: footer_copyright
  translation: "© 2019-{{ .currentYear }} Suru++ Folders by Gustavo Costa and Andrea Bonanni. All Rights Reserved."
<p>{{ T "footer_copyright" (dict "currentYear" now.Year) }}</p>

Also, read: Query a flexible translation with variables and now.

1 Like

That documentation got me confused. Thank you for clearing my confusion!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.