0

Using Google Translate API in Python, how do you indicate that some text is not to be translated? The text I have includes variable names e.g. $name$ that should be left as is. I've tried wrapping these in quotes and angled brackets, but no success so far.

linusg
  • 6,289
  • 4
  • 28
  • 78
  • did you try `$name$`? – Wayne Werner Jan 03 '17 at 22:39
  • Thanks to both responses (and apologies for my slow reply - it's an occasional hobby project), but I'm using python API, so don't think these apply. The snippet of script doing the translation is: t = service.translations().list(source=base, target=targ, format='text', q=[text]).execute() where text is something like: 'Here is my $code$ text' I've tried wrapping the $code$ bit in its own quotes as 'Here is my "$code" text' and also as 'Here is my $code$ text' but no joy so far. – MysteryHopper Jan 24 '17 at 21:24
  • The latter is what i had hoped would apply. Oh, have you tried `service.translations().list(source=base, target=targ, format='html', q='Here is my $code$)`? (disclaimer, I have zero clue what valid formats are) – Wayne Werner Jan 24 '17 at 22:21

1 Answers1

0

I just found something:

This contains <span class="notranslate">$code$</span>, which will be skipped.

Related:

Community
  • 1
  • 1
linusg
  • 6,289
  • 4
  • 28
  • 78