Needs work
Project:
Translation Framework
Version:
6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 May 2009 at 07:29 UTC
Updated:
22 Jul 2009 at 21:49 UTC
Jump to comment: Most recent file
Comments
Comment #1
darren.ferguson commentedCan you apply this patch against the current DRUPAL-6--1 tag in CVS since the one it is applied against is older than what is currently in that branch.
Comment #2
khorpyakov commentedComment #3
EvanDonovan commentedI have tested the patch in #2 and can confirm that it works now when I try to translate content using Google. The old URL wasn't working at all.
Comment #4
EvanDonovan commentedNote that when I used the old URL, I wasn't getting back a response at all.
While this patch works (i.e., the content is translated), the $data->result returned by the drupal_http_request is in JSON format. This means it looks odd in the browser, having all the JSON escape characters in it.
It looks like there are two alternatives:
1) Make the HTTP request in Javascript & then send the result (i.e., the finished translation) to Drupal (so it can be parsed properly in one go using PHP's parse_json function). I haven't tried this.
2) Use drupal_http_request but then parse the JSON, or at least do str_replace to clean up the response. This is what I've done, but my technique is rather poor. I would appreciate any suggestions for improvement.
In _google_translation_split_string:
In google_translation_postprocess:
Comment #5
EvanDonovan commentedNever mind. The original Google Translate URL is working for me now. drupal_http_request() was acting flaky for me before, I guess.
I do have a serious issue with the output it's giving me, which I'll post as a separate issue.