Show:

A bidirectional Language Converter, capable of round-tripping variant conversion.

Language conversion is as DOMPostProcessor pass, run over the Parsoid-format HTML output, which may have embedded language converter rules. We first assign a (guessed) source variant to each DOM node, which will be used when round-tripping the result back to the original source variant. Then for each applicable text node in the DOM, we first "bracket" the text, splitting it into cleanly round-trippable segments and lossy/unclean segments. For the lossy segments we add additional metadata to the output to record the original source variant text to allow round-tripping (and variant-aware editing).

Like in the PHP implementation, each individual language has a dynamically-loaded subclass of Language, which may also have a LanguageConverter subclass to load appropriate ReplacementMachines and do other language-specific customizations.

Classes

ConstantLanguageGuesser
ConversionTraverser
LanguageConverter
LanguageGuesser
MachineLanguageGuesser