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.
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, assumingl10n-path="strong[2]"
was meant to match the firststrong
in the translation with the secondstrong
in the source content, if the content has already been translated at least once and the nodes have already been reordered according to instructions inl10n-path
, the relevantstrong
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.