Home > front end >  Escaping words in between quotes
Escaping words in between quotes

Time:02-10

I am working on a small project using yandex translate api for school. My code has an input field where you type a phrase which will be translated into Russian or other language. There are words that I would like to escape from translation by adding them in double-quotes. There are thousands of words that I would like to escape and adding them into an object or array isn't an option. What I am looking for is to send the phrase to yandex including words in double-quotes and upon return of translated text, to have them words which are still in double-quotes replaced with original words. I would be easy if in that sentence or phrase would be only one word in double-quotes but there might be more than 5 or 10. I don't know if it makes any sense but here's a small example.

input string: This is Anton, he is my best "friend". We met at a local "club" where we played some "snooker".

output string: Это Антон, он мой лучший "friend". Мы встретились в местном «club», где играли в «snooker».

Apologies for not adding any code as I do not have access to my code at the moment.

CodePudding user response:

  •  Tags:  
  • Related