N
N
noob_bot2017-09-29 14:52:07
RESTful API
noob_bot, 2017-09-29 14:52:07

How to add/change translatable resources (REST API)?

I am developing a REST API that should return data to the user in the requested language.
For example: the user accesses endpoint /countries, while the header Accept-Language = en. In response, the user receives

[{
    "id": 1,
    "name": "Russia"
},{
    "id": 2,
    "name":"USA"
}]

What about adding translatable resources? In the database they are as follows:
Entities table
  • id
  • some_property
EntityTranslations table
  • entity_id
  • language_id
  • name
  • description
  • ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question