translate gadget ignores "notranslate" for <text> subelements of <svg>?

416 views
Skip to first unread message

B Lyon

unread,
Oct 28, 2013, 7:57:47 PM10/28/13
to google-tra...@googlegroups.com
I've been playing with the google translator gadget and noticed that it seems to ignore the "notranslate" class on svg text elements.  For example, it will insist on translating the text here

<svg height="300" width="300">

  <text x="40" y="40" class=notranslate>This is svg text</text>

</svg>

It actually inserts <font><font>{translated text}</font></font> inside the svg element, which cannot be rendered in the svg so that nothing is actually displayed.

Has anyone seen this and is there a workaround?  It's messing up a little svg chart I have, where there are text labels on the axes, as it makes them disappear :)



StructuredCable

unread,
Oct 29, 2013, 10:55:55 AM10/29/13
to google-tra...@googlegroups.com
Not sure this will help but I will give it a shot. Your code seems inaccurate. The class is missing the quotations.

<svg height="300" width="300">

  <text x="40" y="40" class="notranslate">This is svg text</text>

</svg>

Hopefully its that simple.

Good luck.

B Lyon

unread,
Oct 29, 2013, 8:31:02 PM10/29/13
to google-tra...@googlegroups.com
Hi SC

Thanks for the tip - I had quotes initially and had tried without quotes that to see if it fixed it, which it did not.

I have created a small sample page that demonstrates this, which can be viewed here



Here's the svg element with no translation (email might chop it up a little):

<svg style="border:1px solid black;position:absolute; top:50px;left:50px" 
         height="100" width="600">
            <text x="10" y="50" class="notranslate">This is svg text enclosed with a "notranslate" attribute.</text>
</svg>

Here's what's in the DOM after I translate the page German via the gadget

<svg style="border:1px solid black;position:absolute; top:50px;left:50px" height="100" width="600">
            <text x="10" y="50" class="notranslate"><font><font>Dies ist SVG Text mit einem "notranslate"-Attribut eingeschlossen.</font></font></text>
</svg>


There's that weird but typical font/font thing in there when it shouldn't be :)  Maybe there's something obvious I'm missing here.

James Trimble

unread,
Mar 5, 2014, 1:08:32 PM3/5/14
to google-tra...@googlegroups.com
You can fix this by enclosing the entire SVG element in a div with class notranslate.

<div class="notranslate">
  <svg>
      <text x="10" y="50">This will not be translated</text>
  </svg>
</div>
Reply all
Reply to author
Forward
0 new messages