Translate a webpage in PHP

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-04-12T11:01:59Z Indexed on 2010/04/12 11:03 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

I'm looking to translate a webpage in PHP 5 so I can save the translation and make it easily accessible via mydomain.com/lang/fr/category/article.html rather than users having to go through google translate.

I've found various easy ways to translate text via CURL, however what i'd really like to be able to do is translate an entire webpage but obviously ignore the tags.

The problem is that Google Translate messes up all the HTML tags, class names etc

Does anyone know of a php class that can translate an entire webpage whilst ignoring the tags?

I'm guessing it may be possible via advanced regular expressions or something like that, but i'm not sure.

I can't just curl Google's response as i'll have all the extra JS that they put in.

Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about translate