I18n rendering breaks when JSON has key "other"

When using a JSON file for i18n, e.g.:

en.json

{
  "contact": {
    "hello": "hello",
    "world": "world",
    "other": "any string"
}

and referring to the keys in an HTML template like this:

<h1>{{ i18n "contact.hello" }}<h1>

the page will correctly render, but if you try to use {{ i18n "contact.other" }} anywhere on the page, all other i18n strings will disappear.

This is not a big issue, I just do not use “other” as a key in my JSON containing i18n but I thought to share.

ps - :man_bowing: thank you for allowing .json files to house my i18n strings, the TOML format is not as compact.

https://gohugo.io/functions/lang/translate/#reserved-keys

Also, TOML seems more compact to me:

[contact]
hello = "hello"
world = "world"
_other = "any string"

As does YAML:

contact:
  hello: hello
  world: world
  _other: any string
1 Like