REST APIs to translate for any language to any language.
API end points
http://localhost:8080/translate/en/hi
$ curl --location --request POST 'http://localhost:8080/translate/en/hi' --header 'Content-Type: application/json' --data-raw '{ "text": "How are you?" }'
{
"originalText": "How are you?",
"translatedText": "क्या हाल है?"
}
FROM_LANGUAGE- Source language (Eg.enfor English)TO_LANGUAGE- Destination language (Eg.hifor Hindi)FILE_LOCATION- Path to the file
$ curl --location --request POST 'http://localhost:8080/translate/html/[FROM_LANGUAGE]/[TO_LANGUAGE]' --header 'Content-Type: multipart/form-data; boundary=--------------------------757881878258573131885729' --form 'file=[FILE_LOCATION]'
http://localhost:8080/translate/html/en/hi
{
"originalText": "<html>\n <head></head>\n <body>\n \\n \\n \n <title>My title</title> \\n \n <meta charset=\"\\"UTF-8\\"\"> \\n \\n \\n \n <div id=\"\\"mydiv\\"\">\n \\n Contents of a div element\\n \n </div> \\n \n <div id=\"\\"mydiv1\\"\">\n \\n Contents of a div1 element\\n \n </div> \\n \n <table style=\"\\"width:\" 100%\\\">\n \\n \n <tbody>\n \\n \n <tr>\n \\n \n <th>Firstname</th> \\n \n <th>Lastname</th> \\n \n <th>Age</th> \\n \n </tr> \\n \n <tr>\n \\n \n <td>Jill</td> \\n \n <td>Smith</td> \\n \n <td>50</td> \\n \n </tr> \\n \n <tr>\n \\n \n <td>Eve</td> \\n \n <td>Jackson</td> \\n \n <td>94</td> \\n \n </tr> \\n \n </tbody>\\n \n </table> \\n \\n\n </body>\n</html>",
"translatedText": "<html>\n <head></head>\n <body>\n \\ n\\ n\n <title>मेरा शीर्षक</title>\\ n\n <meta charset=\"\\"UTF-8\\"\">\\ n\\ n\\ n\n <div id=\"\\"mydiv\\"\">\n \\ n एक div तत्व के घटक \\ n\n </div>\\ n\n <div id=\"\\"mydiv1\\"\">\n \\ n एक div1 तत्व की सामग्री \\ n\n </div>\\ n\n <table style=\"\\"width:\" 100%\\\">\n \\ n\n <tbody>\n \\ n\n <tr>\n \\ n\n <th>पहला नाम</th>\\ n\n <th>उपनाम</th>\\ n\n <th>आयु</th>\\ n\n </tr>\\ n\n <tr>\n \\ n\n <td>जील</td>\\ n\n <td>लोहार</td>\\ n\n <td>50</td>\\ n\n </tr>\\ n\n <tr>\n \\ n\n <td>ईव</td>\\ n\n <td>जैक्सन</td>\\ n\n <td>94</td>\\ n\n </tr>\\ n\n </tbody>\\ n\n </table>\\ n\\ n\n </body>\n</html>"
}
Run TranslateApplication.java as a java application.
Your Spring boot Application will now be running on localhost:8080