Code Escaping Algorithm is an algorithm to ensure that the codes within the translatable texts remain the same (escaped) after being passed through the machine translators.
The text in your game besides containing text, most likely also contains scripts, variables, tags and whatever they are called it.
The general practice is you want to translate the texts, and leave the scripts and tags alone. Why, you might ask? Well … a slight change on those tags will cause a nuclear warfare. And every extra space on the tags a cat will be killed.
The problem is, The machine translators is so stupid that they can’t tell the differences between translatable texts and tags. They will translate anything blindly whether it is a text or tags.
To make it easier to understand, take a look at the figure below :
Depend on the translator engine, there is several algorithm currently available
None (no escaping)
To let the machines do what they liked. You’ll let them take over your translation project and wreak havoc on your game.
This algorithm will replace all the known tags into meaningless words that can not be found in the dictionary in hopes that the machines will leave them alone.
The translation results are good. The context in one sentence is preserved.
This is not a fool proof, because sometimes the machine will find their way to mess these words by adding extra spaces.
When that happens, you will find a random gibberish text in the translation results. (Something like Qxyawhhj)
This algorithm will store all known tags into memory and will omit it from being sent to the machine.
This algorithm is almost guaranteed that the escaped tags will be preserved…. With one serious problem … the translated word loses their context in the sentence. It’s almost like word by word translation. In short, this algorithm will produce less messed up code but with a bad translation.
This algorithm will hide the escaped words inside the HTML tags. By far, this is the best algorithm. But only a small number of engines support this algorithm.
This algorithm will mask the string into 7 byte hexadecimal numbers (or any substitutable format) that will be ignored by the translators.
This is the only algorithm that supports Custom Escaping patterns.