How to integrate i18n translation resource saved as JSONB data and fetched with REST API on React?

21 Views Asked by At

I'm required to save the key-value translation resource for i18n internationalization in a Postgres Database to I decided to use JSONB data to save the key-value resource.

So far, I came up with this response on the API.

[
  {
    "id": 2,
    "language": "EN",
    "data": {
      "title": "Learn JSONB",
      "description": "Learn to insert i18n translation data with JSONB"
    }
  },
  {
    "id": 1,
    "language": "ID",
    "data": {
      "title": "Belajar JSONB",
      "description": "Belajar menyimpan data terjemahan i18n dengan JSONB"
    }
  }
]

Now, I need to integrate it with i18n on the frontend side using React. The solutions I've found so far only show how to integrate i18n resource as a JSON file.

Is it possible to use this REST API response as the i18n resource? And how do I implement it?

0

There are 0 best solutions below