Rachit95 / google-api-for-dotnet

Automatically exported from code.google.com/p/google-api-for-dotnet
0 stars 0 forks source link

Linebreaks on translations #36

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm having problems with line breaks in the translations. How do I accept
line breaks in translation? (I use the C# language)

My code:

Google.API.Translate.TranslateClient client = new
Google.API.Translate.TranslateClient("");

txtBox2.text = client.Translate(textBox1.Text, Language.English,
Language.Portuguese);

Original issue reported on code.google.com by lord.iom...@gmail.com on 7 Jan 2010 at 4:24

GoogleCodeExporter commented 8 years ago
is there already a solution for this issue?

Original comment by bernhard.zechmeister@gmail.com on 10 Oct 2010 at 11:30

GoogleCodeExporter commented 8 years ago
my workaround:

1. replace all \r\n with <BR> and then translate it.
2. replace the other way round

string source = text.Replace("\r", "").Replace("\n", "<BR>");
string translation = client.Translate(source, "en", "ro");
translation = translation.Replace("<BR>", "\r\n");

Original comment by bernhard.zechmeister@gmail.com on 11 Oct 2010 at 6:26