Translating with python except variables

Viewed 36

I am trying to translate Stellaris game files to turkish language using deep translate library.

toBeTranslated = "All £blocker£ §YTile Blockers§! have been cleared from [From.From.GetName]."

translated = GoogleTranslator(source='en', target='tr').translate(text=toBeTranslated)

Problem is that it is going to translate variables too. Variables are in this case what is between [ and ]. Other variables can be between § and §. Or variable can be what is between £ and £. So in this case I dont want string £blocker£ and §YTile Blockers§ and [From.From.GetName] to be translated because these 3 strings are variables but everything else should be translated. How can I achieve this?

0 Answers
Related