Hi,
Google translate supports now also Dutch - English and English - Dutch translations. How can I use this in this module? I can't find Dutch in the list box in admin section of this tool.

Best regards,

Sjaak Terwindt

CommentFileSizeAuthor
#6 babeltr.zip8.42 KBxeladrane
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xeladrane’s picture

You can add other languages and the order they're displayed in the dropdown by updating the function in the bottom of the file "gtrans.module". I discovered this by updating "Deutsch" to be "German":

function gtrans_get_avail_langs(){
return array(
'ar'=>t('Arabic'),
'en'=>t('English'),
'fr'=>t('French'),
'de'=>t('German'),
'it'=>t('Italian'),
'es'=>t('Spanish'),
'pt'=>t('Portugese'),
'ja'=>t('Japanese'),
'zh-CN'=>t('Chinese'),
'ko'=>t('Korean'),
);
}

So you can add another item, i.e. something like

'nl'=>t('Dutch'),

Similarly you can update the language that appears by default for translation by updating this line in the same file and replacing 'fr' for French with say 'it' for Italian:

'#default_value' => ($_SESSION['hl']? $_SESSION['hl'] : 'fr'),

The bit I have a problem with is that it returns a blank page and does not translate, and the error message I get seems to imply that google translate is trying to translate the SRC for the images I have embedded in the content on the page, i.e.

Message: Attempt failed to translate page /blah/blah/files/images/image5.jpg to Italian:
Content I got was:
Severity: notice

Anyone that can help with this I'd appreciate it. I figured out it's working by opening a PHP socket connection to the google translate engine and then grabbing all the returned text content. However, it's clearly failed to get any content at all, which isn't surprising if it's trying to translate an image!

sjaakter’s picture

Hi,
Thanks. I too have the problem that the pages aren't returned translated. I'll try to find another module. It seems to me this module isn't maintained anymore.

Best regards,

Sjaak Terwindt.

xeladrane’s picture

I think it's probably not something that Google are in support of, since it strips their branding.

You could try updating the line about the Google URL, as it appears google have moved their hosting, i.e. change:

// Google Translate URL
		$url = 'translate.google.com';

to

// Google Translate URL
		//$url = 'translate.google.com';
		$url = '64.233.179.104';

Also you might try the patch suggested in http://drupal.org/node/146017, replace the line where it assigns $content to $content_array[1] with:

				$content = substr($content,strpos($content,"<!DOCTYPE"),strpos($content,"</html>")-strpos($content,"<!DOCTYPE")+7);
				

Hope this works for you. Agree there seems to be little or no active support on this module at the moment, but I can't find anything else quite like it. Also tried a port to Babelfish but it's more tightly controlled by the looks of things.

owahab’s picture

Assigned: Unassigned » owahab
owahab’s picture

Status: Active » Fixed

I have added new languages (Greek, Dutch, Traditional Chinese, etc) to the upcoming 1.5 version.
Will be released very soon.

xeladrane’s picture

FileSize
8.42 KB

Sounds great, I was wanting Dutch as well.

Did you find the issue with JSTools I think it is, where it introduces extra "\r\n" items within the genuine page content, and hence the content_array[1] item does not contain the full page?

Also, I found that having images in the page generates additional GET requests from the web browser, which naturally enough Google cannot translate, so there appear irrelevant lines in the watchdog and unecessary delays in loading the page.

Let me know if you'd rather these were logged as separate issues on here, or if I can do anything useful to help. I'm new to PHP I'm afraid but it makes sense just reading it through if I don't need to change much.

PS. Did you consider writing a Babelfish version, it looks like it might work and you won't need to undo edited links etc. I had a go (as attached) but it fails to run just now so I've made a PHP syntax error somewhere and my Ultraedit isn't configured to help me debug.

owahab’s picture

First, I didn't have time for testing JSTools actually. I am planning to re-write this module for D6.

Second: I didn't have this issue before sine images aren't actually sent to Google in my test cases.

Third: Yes, please report any bug you see, to have more users contributions like confirming it or adding more details.

Fourth: I do not really have that much time to do a bablefish version. If you can provide a patch to this module that would be great, sending a zip file doesn't help really.

xeladrane’s picture

Thanks for your reply. I'll look out for v1.5 and then test it with and without the Javascript Tools module. I expect the images issue will go away by itself. Have given up on the Babelfish idea, it gets stuck in a refresh loop and forces the upper frame to exist as far as I can tell.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

v8powerage’s picture

Status: Closed (fixed) » Active

Hi
Last times Google added a lot new languages, could somebody update this module, please?

edo888’s picture

Status: Active » Fixed

Try the last version for Drupal 6.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.