Guess Translations From Similar Already Translated Strings

Plugin source location: <serge_root>/lib/Serge/Engine/Plugin/

Plugin always attaches itself to the following callback phase: get_translation.

Given a source string to translate, this plugin finds similar strings in the database by trying different transformation combinations, and then guesses the translation for the source string by applying the same chain of transformation to the pre-existing similar translation. Transformations include adjusting whitespace, ending punctuation, HTML tags, or applying different case.

This plugin speeds up the translation when small tweaks are applied to source strings in the course of product development.


We get a new string, "HELLO, WORLD", that has no translation into Russian:

New string: "HELLO, WORLD" → no Russian translation

The plugin detects that in the Serge database associated with the current job there's a similar "Hello, world!" string, which already has a Russian translation:

Existing string: "Hello, world!" → Russian translation: "Привет, мир!"

The plugin tries to guess the desired sequence of transformations needed to go from "Hello, world!" to "HELLO, WORLD":

"Hello, world!" → (???) → "HELLO, WORLD"
"Hello, world!" → (uppercase) → (remove exclamation mark) → "HELLO, WORLD"

Once the transformation has been determined, it applies it to the Russian translation of the original string:

"Привет, мир!" → (uppercase) → (remove exclamation mark) → "ПРИВЕТ, МИР"

And the resulting translation, "ПРИВЕТ, МИР", is returned by the plugin as a fuzzy translation, ready for review:

New string: "HELLO, WORLD" → Russian translation: "ПРИВЕТ, МИР"