Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change discontinued Microsoft Translator API to the new Azure API #201

Merged
merged 2 commits into from
Aug 7, 2018

Conversation

svdvonde
Copy link
Contributor

@svdvonde svdvonde commented Aug 6, 2018

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 visiting http://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 in urls.py. But I am not sure if that is the case, so I am not making that change.

@mbi
Copy link
Owner

mbi commented Aug 6, 2018

Thank you! I'll test this tomorrow morning (need a credit card to set up an Azure account) and I'll update the documentation…

Cheers!

@svdvonde
Copy link
Contributor Author

svdvonde commented Aug 6, 2018

If you want I can PM my second api key (azure offers a primary and secondary key) and simply cycle it afterwards... does github have pm's..?

@mbi mbi merged commit 8c7efe3 into mbi:develop Aug 7, 2018
mbi added a commit that referenced this pull request Aug 7, 2018
@mbi
Copy link
Owner

mbi commented Aug 7, 2018

Thanks again!

@svdvonde svdvonde deleted the microsofttranslator branch August 10, 2018 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants