-
Notifications
You must be signed in to change notification settings - Fork 61
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
Implement TranslateArray service #5
Comments
looking forward to this feature,anything i can do? |
Hi! Absolutely, I was hoping for some help going forward. I had intended to include this in the 0.3 Release, but needed some more time to think about the implementation after I discovered how the TranslateArray service worked. .. Looking at that documentation link in the original issue, from the description of the
Is this the behavior you would expect from a TranslateArray service? My own assumptions were that you could specify a to/from language pair PER translation in the array, but it does not seem to work that way, even when using the AUTO_DETECT. It would of course be possible for us to overload the Translate.execute() method to perform such functionality (albeit in an entirely manual, multiple-call kind of way) Something like this, maybe...
I think that the first method is OK as long as it is clear that every text in String[] must be of the same language. It is also correct in that The second method is probably a bad idea as it just confuses the issue and provides functionality that a client could easily build. Indeed, it would probably be easier for a client just to make multiple calls to execute() than to build 3 different arrays and pass them in. I'd like to hear your thoughts on the issue and your expectations for this functionality. Feel free to fork away on the code and issue pull requests. I'm a GitHub noob, but I'm anxious to experience some of the 'social coding' aspects. -jonathan |
hi, -Weilie Chen |
I agree with you about the behavior of TranslateArray. Thanks for the discussion, it really cleared my head on the issue. I can likely get that functionality in for 0.4 sometime this weekend or early next week. Otherwise, if you were motivated enough to take it on yourself, you're more than welcome to do so. You could take a look at the way DetectArray service was implemented in the Detect class and try to follow that pattern. What do you mean by Translate Client Pool? Do you mean a pool of clients that have different ApiKeys associated to them? As I understand it, Microsoft tracks usage not only by ApiKey, but by IP Address as well, so I'm not sure how this feature would alleviate the rate limits. ...or are you thinking of a cache, so that we do not repeat calls to the API for identical translation requests? If so, that is something I've considered and in fact something I implemented for the grails-translate plugin that uses this library. My gut feeling is to let the library mature without bulking up too much before pulling such features in. |
Weilie - Forget about forking the code, I was able to implement the TranslateArray service this morning. I will merge it over to the master branch and release a SNAPSHOT of the 0.4 release that you may use. Are you using Maven for your projects or are you downloading the JARs and including them in your /lib? |
thanks for your great job! |
You're welcome, I appreciate the feedback about TranslateArray. I uploaded the 0.4 snapshot jar with the changes. Or, if you're using Maven, just add this to your POM.xml:
|
The bulk, array-based version of Translate
documentation
The text was updated successfully, but these errors were encountered: