0

I have a JSON file with static data that I want to translate it.

{
            "id": "",
            "name": "text",
            "label": "Text",
            "value": "Some random text"
}

So I want to save my static texts to i18n files and then load them in selected language. I tried something like

{
                "id": "",
                "name": "text",
                "label": "{{ json.text | translate }}",
                "value": "{{ json.someRandomText | translate }}"


}

Any suggestion?

  • Can you provide a bit more context on why you would want to do this? Most probably the simple solution would be to put the translation key into the value and use the key to read from the translation file. – mattanja Feb 17 '22 at 10:55
  • I need a list of multiple types of inputs (text, text area, etc.) to generate the page dynamically. I follow this guide https://eliteionic.com/tutorials/creating-dynamic-angular-forms-with-json/ but I need them translated. Also, there will be more fields like validators and options. @mattanja – Andrei Kruza Feb 17 '22 at 11:09

0 Answers0