I tried with strings instead of integers, and still nothing, but a different error :
ERROR: 2015/06/15 template: partials/meta.html:71:13: executing "partials/meta.html" at <index $mymonths .Dat...>: error calling index: time.Month is not index type for map[string]interface {} in partials/meta.html
@spf13 if you guys would like to merge my “multilingual” tutorial PR to the docs, a good place for this piece to go might be inside that, since the topic fits.
@nicolinuxfr in the end, was it the {{ index $mymonths (printf "%d" .Date.Month) }} that @bep suggested that worked? I’d like to try it on my end today.
@nicolinuxfr it’s up. The technique I use is to make the locale name be the file name, then leverage that fact, but yes, since each language has a config file, it might work. Though I’m not sure of functional differences between how config.toml works, and /data/path/to/myfile.yaml works.
Sorry I didn’t even answer the topic. But thanks for the tutorial ! In fact, I had a chance to use it again very recently for a new project and it worked really well, so I think explanations were good.
Hi,
Thanks for the suggestion. Unfortunately I’m writing a Theme and I don’t want (or don’t know how) to mess with the Data subdir of Hugo.
I’ve come up with a simple solution, using the i18n files of the template:
Since {{.Date.Month}} gives June for example, we can write in the template: