1. Home
  2. Docs
  3. Translator++
  4. Code Escaping Algorithm

Code Escaping Algorithm

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 :

Escaping tags

Depend on the translator engine, there is several algorithm currently available

Code Escaping Algorithm available on Yandex Engine


These algorithm is not fool proof.
Your beloved machine translators will always find a way to mess your code up. It is guaranteed!

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.

Meaningless Word

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.

Pros :

The translation results are good. The context in one sentence is preserved.

Const :

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)

Aggressive Splitting

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.

HTML Cloaking

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.

Was this article helpful to you? Yes No