ali_kiyani Posted January 28, 2011 Share Posted January 28, 2011 Hi, I am trying to translate a page in PHP using Google API. There is 5000 chars limit on data that you can send to Google at a time. So I am trying to break the page into pieces of 5000 chars. But as you know while doing this we have to keep in mind the HTML formatting that it should not be disturbed otherwise you will not get desired results. For example you have to send this: <a href="#" class="myclass">Link</a> Instead of this: <a href="#" class="myclas I am able to solve it somehow (although not perfectly I guess) by checking if "<" sign is coming after ">" sign or not. If "<" sign is coming after ">" then I go back to the point where I found ">" and cut string from there. Anyway the point is I am still having some problems regarding HTML formatting and want to know how to do it efficiently. Is there any parser available that will solve this problem!? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/225944-how-to-break-page-into-5000-chars-piece-for-google-translation/ Share on other sites More sharing options...
dreamwest Posted January 28, 2011 Share Posted January 28, 2011 You mean like this http://www.wizecho.com/ Quote Link to comment https://forums.phpfreaks.com/topic/225944-how-to-break-page-into-5000-chars-piece-for-google-translation/#findComment-1166472 Share on other sites More sharing options...
ali_kiyani Posted January 28, 2011 Author Share Posted January 28, 2011 You mean like this http://www.wizecho.com/ Not exactly because when of my requirement is that the HTML source code when viewed in browser should display that translated language for SEO purpose. What they are doing is converting text after it is displayed in browser. I want to translate before something is displayed on page and only translated content is displayed rather than first displaying English content and then translating to other language. But what ever their technique is, I want to know how to break HTML in 5000 characters properly. Quote Link to comment https://forums.phpfreaks.com/topic/225944-how-to-break-page-into-5000-chars-piece-for-google-translation/#findComment-1166477 Share on other sites More sharing options...
ali_kiyani Posted January 31, 2011 Author Share Posted January 31, 2011 No one??? Quote Link to comment https://forums.phpfreaks.com/topic/225944-how-to-break-page-into-5000-chars-piece-for-google-translation/#findComment-1167714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.