Comparing .Site variable with other variables bug?


First of all, hats off to every Hugo contributor. This is an amazing tool!

Today I think I may have hit a bug in multilingual site setup.
I’m trying to compare 2 variables .Site.Data.translations with .Site.Language. But for some reason I can’t use .Site.Language directly.
For the template to compile without errors I need to create a temporary variable $siteLanguage with printf.

Is this normal behaviour? Or am I just doing something wrong?

I have a file under /data/translations.toml with the following contents:

en = "en_US"
es = "es_ES"

My template:

{{ $siteLanguage := printf "%s" .Site.Language }}
{{ with index .Site.Data.translations $siteLanguage }}
{{ end }}

Template that breaks:

{{ with index .Site.Data.translations .Site.Language }}
{{ end }}

The error shown for the broken template is “ERROR: 2017/02/13 17:58:42 general.go:236: partials/index/file.html is an incomplete or empty template”

I’m using: Hugo Static Site Generator v0.18.1 BuildDate: 2016-12-29T17:12:41Z

Thanks again for this amazing tool!