Extension:Translate/Mass migration tools/Alignment

Alignment Algorithm
Assumptions:
 * 1) The translation has paragraphs in the same order as the original

The step 2 of this project requires importing the translations which were already present before FuzzyBot's edit to the page. These need to be aligned with the translation unit identifiers made by the Translate extension.



As per the mock up design, the only thing we need to worry about is filling out the left and right hand side blocks with appropriate texts. The left hand side blocks are for the source text (English) and the right hand side blocks are for the corresponding imported translations.


 * 1) Left-hand-side blocks: The left-hand side blocks would contain the source text and would not be editable. The source units would be obtained using the WebApi and
 * 2) Right-hand-side blocks: The right hand side blocks would contain the translations of the language code specified for a given page. The logic involved would be as follows:
 * 3) Find the timestamp of FuzzyBot's oldest edit on the page using the WebApi   and
 * 4) Reduce the timestamp by 1 second and use it as the starting timestamp for   to get the revision before FuzzyBot's revision on the page.
 * 5) Fetch the text for that revision and split it on double newlines ('\n\n') to obtain the translation units on paragraph level.
 * 6) Import features: Corresponding to each translation (target) unit, a set of features would be added. These include:
 * 7) Delete unit:
 * 8) Add a unit below:
 * 9) Swap with unit below: