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.
Do we want to allow the user to import JSON files through the UI or REST endpoints? If so what is the template for the JSON file?
Do we want the user to add translations without importing anything but using UI elements like inputText for typing the translations?
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:The same version of the SQL script using REST is now:
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.