Re-do translation with missing fields

Ben Knight asked on January 10, 2018 10:55

Hi there,

Currently I have done a translation Import/export process for my site in another language. Upon doing the Import of the translated version, I have noticed that I missed some fields with the "Translate field" checkbox.

I now want to do another export of just the fields that have been missed so only those are sent to be translated and then import the results to create a full and complete culture.

Is this possible with how Kentico currently does the Export/Import for the XLF files, or will I have to do some manual WinDiff magic and compare and manually alter the files?

Thanks

Recent Answers


Trevor Fayas answered on January 10, 2018 16:19

Just to understand, you want to know if you import a XLF that only has the missing fields, will it 'delete' the already translated content or just add the stuff in the XLF, correct?

Using JustDecompile, the method TranslationServiceHelper.TranslateDocument contains the logic for actually translating the document once the XLF (or whatever translation service you are using) is imported.

Here's the logic summary:

  1. Loops through the Target Languages from the Translation Services
  2. Gets the Language variation of that Tree node it's translating
  3. Gets the Document Fields for that Node (all document fields)
  4. Calls TranslationServiceHelper.TranslateFields on The document, which...
  5. If the Field is marked as Translate Field and is a translatable field, then...
  6. Get the original value of the field
  7. Call service.Translate on the original value, the source language, and the target language.
  8. Sends that translated value to the TranslateField method, where...
  9. If the translated value is null or empty, skips, otherwise it sets the value on the translated document and returns true.
  10. This true/false is then returned to the Translate field, which is passed to the parent.
  11. If no fields are translated, then the object is not modified, if any field is translated, it's returned true.

So based on that logic, if your XLF contains a translation that is NOT translated, and is the value of the original field, it WILL overwrite it because it doesn't know that the item is NOT translated, and just as is. However, if your XLF doesn't translate that field at all, it will not modify the field and should leave the remaining translation alone.

This is just from looking at the code, so you may want to consider temporarily setting the other fields as "Not translatable" so they are skipped, and only setting the new fields as Translatable, generate your XLF then (so it only contains the new fields), have it translated, then import.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.