How to add an array in a translation file

Hi. I’m using a single .toml file to include the translation in a website.
The problem is that the whole translation file structure feels very rigid: key: label, key: label, key: label

What if I want a list of cards (title, header) with an unknown number of items? (something I’d use a range for)

Is there a way to cover that? Or am I forced to add item1, item2, item3, item4, item5 in the translation file and 5 times the markup in the html file?

Any reason why you are not using Hugo’s i18n feature?

1 Like

I am
and the format is simple: “key”: “translation”
And I can’t do any grouping with them. I can’t make a list of features, for example, then iterate through them

I see. You should check out Data

@mirkea Curious to know you if were able to solve your array translation issue. I have the same question and can’t find any trivial solution. Thanks!

Have a look at this multilingual website, where all translation is done through JSON files:

Thanks @martignoni. That helps a lot!


1 Like