What is the correct i18n syntax in a range sort bracket


As I have many contents, I created a unique content interface in an excel file, which I transform to CSV and to toml into the i18n files. Even if the process of extracting and copying into the i18n files need 5 minutes, I found this method really powerful :

  • I have a very good overview on my content and SEO features for each page
  • I can make all translations
  • I can copy in word to make a orthograph check and copy back in Excel
  • I have no language content in my front matter, layouts or contents. Therefore, I just copy the content file from one language to other. If I change the layout or the front matter of a page, I just copy the file without carrying of losing data.
  • Benefit of Excel fonctionalities to wild changes (ex: change all my image name access with “_” to “-” for a better SEO)
    Once I will have finish my website, I will share the whole process in the “tips and tricks” section.

One of the challenges in this process was to find the right syntax to call I18n ID in the code which is so poorly documented on hugo website. It has been quite challenging sometimes but I fixed almost all. Only one is missing.

I would like to range differently my services or my references for each language of my multilingual website. In my Excel file (then in the i18n.toml file), I have ID with a number for ranking. Here I want the image of “Definition” will be in second position.

When I write number directly in the front matter, this code without translation key works perfectly.

{{ with .Sections }}
          {{ range sort . ".Params.position" }}
{{ end }}

But when I want to reach a translation key which I wrote in the front matter with the following various semantics, it nevers works. Which is the correct syntax to call a translation_ID of the i18n file in a “range sort” bracket ?

{{ with .Sections }}
      {{ range sort . (T ".Params.position") }}
      {{ range sort (T ".Params.position") }}
      {{ with .Params.position }}
                    {{ range sort .}}
      {{ end }}
{{ end }}

Thanks for your ideas.