Code a translation fixer
Level: Advanced (score: 4)
Imagine you built PyBites' new translation feature. You managed to successfully get translated text for a Bite, but there's a problem: the Python code inside the HTML code
and pre
tags gets translated too (yes, this actually happened to us!). Nobody ever said developer life was going to be easy right? (chuckle)
As we code in English, we require all code snippets to be in English even if the overall Bite description is being translated to another language.
Luckily, by now, you've mastered some text manipulation and regex skills (this is an advanced Bite after all) so you will write some code to fix this for all future translation calls.
Here is a small example (we test 3 different ones in the associated tests):
Original English Bite text:
Translator output which translated everything, description and code, to Russian:
You will take both output instances and produce the desired output: the description is in Russian while the code content in the code
and pre
tags is left intact (English):
Good luck and keep calm and code in Python.