Extension:Translate/Mass migration tools/Alignment

This page is outdated, see 69310

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) Once the units are split on '\n\n', align them on h2 level, i.e, the first h2 header in source should match with the first h2 header in target. Empty units can be added or units could be collapsed if there is not enough room to align.
 * 7) Split the resulting units so that there does not exist a unit containing a mix of headers and other wiki text.
 * 8) After this, the user can manually adjust the units by using the features mentioned below.
 * 9) Import features: Corresponding to each translation (target) unit, a set of features would be added. These include:
 * 10) Delete unit: This deletes the corresponding unit and shifts the target units up.
 * 11) Add a unit below: This adds an empty unit below the current unit.
 * 12) Swap with unit below: This swaps the text of the current unit with the unit below.