Change discontinued Microsoft Translator API to the new Azure API #201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in issue #200, changed the old Microsoft Translator API to the new Azure Translator API using the requests framework (which was desired).
Besides updating the documentation to reflect that the only necessary setting is the
AZURE_CLIENT_SECRET
(AZURE_CLIENT_ID
is not used), one more change is necessary which I wasn't sure how to handle correctly.In
/rosetta/templates/rosetta/js/rosetta.js
on line 24 the URL of the translation service is hardcoded as"./translate/"
. This results in the path of the URL being something like/rosetta/files/project/fr/0/translate/
(if the call is made on the/rosetta/files/project/fr/0/
page). The intended result is the/translate/
path at the root of rosetta. For example, the code of the pull request can be tested by visitinghttp://127.0.0.1:8000/rosetta/translate/?from=en&to=fr&text=Some+text+to+translate
. If the path is always/files/project/<lang>/<number>/
then the problem is easily resolved by simply updating the translation path inurls.py
. But I am not sure if that is the case, so I am not making that change.