Solved

How do I keep text formatting when using Google Translate?

Posted on 2013-11-12
5
1,536 Views
Last Modified: 2013-11-12
Hi,

I am new to using Google Translate and I have found that it strips breaks <br /> when text is translated. Is there a way I can stop this from happening so that the text can retain its original formatting.

Example:
http://www.educationpages.co.nz/55-Intermediate/Murrays-Bay-Intermediate-11263/View-details.html
0
Comment
Question by:jwleys
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39643465
no, I see lot of people complaining about that and there's no solution as there's no such setting to apply :
https://translate.google.com/manager/website/settings
0
 

Author Comment

by:jwleys
ID: 39643503
I wonder if anything can be applied at an API level or if anyone has any hacks that work including supplementing <br /> for <p> etc ...

Thanks for your input though it is much appreciated.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39643545
IMHO it's normal for Google to remove linebreak before translating a text because sentence will not have the same length.

English (not the br at the end)
be or not to be be or not to be be or not to be<br />
be or not to be be or not to be be or not to be<br />
be or not to be be or not to be be or not to be<br />
be or not to be be or not to be be or not to be<br />

French :
être ou ne pas être être ou ne pas être être ou ne pas être<br />
être ou ne pas être être ou ne pas être être ou ne pas être<br />
être ou ne pas être être ou ne pas être être ou ne pas être<br />
être ou ne pas être être ou ne pas être être ou ne pas être<br />
être ou ne pas être être ou ne pas être être ou ne pas être<br />

I don't know any hack. Did you try to replace <br /> by a <div></div>
0
 

Author Comment

by:jwleys
ID: 39643626
Good suggestion, seems to work and diverts the problem to being a data issue rather than a programming issue which I like :)
0
 

Author Closing Comment

by:jwleys
ID: 39643633
Thanks for your help
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question