konveyor / tackle-pathfinder

Tackle Pathfinder application
Apache License 2.0
16 stars 23 forks source link

[TACKLE-302]-Add New Translations #122

Closed carlosthe19916 closed 3 years ago

carlosthe19916 commented 3 years ago

Based on https://github.com/konveyor/tackle-pathfinder/pull/108

https://issues.redhat.com/browse/TACKLE-302

What this PR is adding?

This PR is adding a new endpoint POST /translator/translate to allow translating an element of the questionnaire. Without this PR in place, the only way to translate an element of a questionnaire is to execute SQL scripts like:

INSERT INTO translated_text (id, deleted, key, text, language)
SELECT nextval('hibernate_sequence'), false,
       'Category_' || id || '_name', 'Detalles de la aplicación', 'ES'
FROM category
WHERE name = 'Application details' and deleted is not true;

The same version of the SQL script using REST is now:

POST /translator/translate
{
 "id": 123456,
 "table": "Category"
 "field": "name"
 "text": "Detalles de la aplicación",
 "language: "ES"
}

Given a questionnaire, how to translate the questionnaire to a certain language?

Let's imagine we have a questionnaire with 2 Categories, 10 questions, and each question has 5 possible options. Then, the endpoint must be used to translate each category, question, and option. The number of times the endpoint POST /translator/translate should be called is: 62

*2 + 10 + 510 = 62**

Given this way of translating it is natural to think that the UI should be the one in charge of managing the calls for translating.

Unclear requirement!

Even though this PR technically works fine it is unclear what is the exact requirement for translating the questionnaire.