zbraniecki / l20n

Python l20n support library
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Make reordering work with retranslation #6

Closed stasm closed 12 years ago

stasm commented 12 years ago

When retranslating a node, if it's been translated before and some child nodes have been reordered, l10n-path attributes end up pointing to wrong nodes. For instance, assuming l10n-path="strong[2]" was meant to match the first strong in the translation with the second strong in the source content, if the content has already been translated at least once and the nodes have already been reordered according to instructions in l10n-path, the relevant strong is now the first strong.

In this patch, instead of keeping a shadow copy of the source content somewhere, I suggest that we detect if the node in the current DOM already defines a l10n-path and follow it if so.

Hopefully the comments in the code will make this much clearer.