guptahanu / google-ajax-apis

Automatically exported from code.google.com/p/google-ajax-apis
0 stars 1 forks source link

Language API inconsistently rearranges html during translation #149

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

t='<h2><a href="test.html"> some </a> text </h2>';
google.language.translate(t, 'en', 'de', function(r){
  console.log(r.translation);
})

What is the expected output? What do you see instead?

expected: '<h2><a href="test.html"> einen </a> Text </h2>'
actual: '<h2><a href="test.html"> einen Text </a></h2>'

Why does it put 'Text' inside the anchor tag???

Original issue reported on code.google.com by balazs.endresz on 23 Nov 2008 at 6:45

GoogleCodeExporter commented 8 years ago
If it looks like a sentence it works fine:

var t='<p><a href="test.html"> Some  </a> text. </p>';

google.language.translate(t, 'en', 'de', function(r){
  console.log(r.translation); //->"<p> <a href="test.html">Einige</a> Text. </p>"
})

Original comment by balazs.endresz on 27 Nov 2008 at 1:44

GoogleCodeExporter commented 8 years ago

Original comment by jrgeer...@gmail.com on 1 Dec 2008 at 12:45

GoogleCodeExporter commented 8 years ago
I have the same issue and it is not fixed by making the text a sentence.

The very simple html below illustrates the problem converting English to German:
<html><head></head><body>The quick brown <font color='#ff0000'>FOX</font> jumps 
over 
the lazy <font color='#0000ff'>Dog</font>.</body></html>

Returns:
<html><head></head><body> <font color='#ff0000'>Der</font> flinke rote Fuchs 
springt 
über den trägen <font color='#0000ff'>Hund.</font> </body></html>

Although the translation is ok, the html, in this case colour, has been 
destroyed.
'The' (Der) becomes red instead of 'Fox' (Fuchs), notice also the full stop has 
now 
been moved inside the blue font colour tag. 

I am using the AJAX Language API from other Non-Javascript environments in this 
instance with the parameter:
@format=html

Original comment by gowww....@gmail.com on 15 Dec 2008 at 3:28

GoogleCodeExporter commented 8 years ago
Thanks for the input, guys.  We have been looking into fixing this and it's not 
a trivial problem.  We have made 
some initial changes but they don't fix this example that you have provided, so 
we will continue to try to make 
this better.  Over time we can hopefully improve on this.

Thanks,
Ben

Original comment by lisba...@google.com on 6 Jan 2009 at 10:32

GoogleCodeExporter commented 8 years ago
Hello,

I've a similar issue:

1) Original: <a href="/es-es/empresa" title="Empresa" class="rmLink"><span 
class="rmText">Empresa</span></a>

2) "es" to "en" translation

3) 
Expected value: <a href="/es-es/empresa" title="Company" class="rmLink"><span 
class="rmText">Company</span></a>

Returned value: <span class="rmText"><a href="/es-es/empresa" title="Company" 
class="rmLink">Company</a></span>

Original comment by m.serr...@gmail.com on 10 Sep 2009 at 12:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Issue 342 has been merged into this issue.

Original comment by jscud.w...@gmail.com on 7 Aug 2010 at 2:41

GoogleCodeExporter commented 8 years ago
Issue 452 has been merged into this issue.

Original comment by jscud.w...@gmail.com on 7 Aug 2010 at 2:44