daledotshan/liferay-portal — pull request #155 by zxdgoal (2014-12-16 08:52:22+00:00)
Title: LPS-52196 Structure/web content with repeatable text field lists fields in translation incorrectly.

Hey Dale

LPS-52196 is the issue about translation sorting incorrectly which I have discussed with you.

But this commit is trying to fix more.

To begin with, when adding an instance for a repeatable field, the translation simply not works because TranslationManger is not registered for it. This is because when calling _getField, the instance is a field, not form, so we can not retrieve attr TranslationManger from field. I got TranslationManger from its parent.

Secondly, when adding an instance for a repeatable field, the order of translated content is not correct. This is because when sending whole contents to back-end, the instance added newly is missing in translated content.

For example. before adding an instance, the mapping between default language and another language, is[ {1, 1_fr}, {2, 2_fr}].

After adding, the mapping is {1, 1_fr}, {2_add}, {2, 2_fr}]. So the translated value for "2_add" is missing (Undefined). The amount of input for default language and the other language is different, which causes the issue LPS-52196.

So the key thing is that never send undefined value to back end. If we found some inputs are missing in a translated instance, just copy the value in default language.

Let me know if you have any questions.

Thanks
John.