Problem/Motivation

Steps to reproduce:
- Create a job and submit it to a local translator
- Log in as a local translator
- Click on the assigned local task item
- Provide a translation
- Save translation
- Open the same local task item page for translation

At this point I would expect to see source text and updated translation on the right side, but it looks like that both fields (source and translation) are updated with translation.

Default text.

Updated source text.

Comments

mbovan created an issue. See original summary.

berdir’s picture

#2682337: Add the preview feature to translator local has fixes for this. Lets extract that part from that issue into this.

edurenye’s picture

Assigned: Unassigned » edurenye
edurenye’s picture

Status: Active » Needs review
StatusFileSize
new9.03 KB

Done.

berdir’s picture

+++ b/translators/tmgmt_local/src/Form/LocalTaskItemForm.php
@@ -345,4 +345,35 @@ class LocalTaskItemForm extends ContentEntityForm {
+  private function prepareDate(array $translation, $key = array()) {
+    if (isset($translation['#text'])) {
+      if (isset($translation['#translation']['#text'])) {
+        $translation['#text'] = $translation['#translation']['#text'];
+      }
+      else {
+        $translation['#text'] = '';
+      }
+      return $translation;
+    }
+    foreach (Element::children($translation) as $item) {
+      $translation[$item] = $this->prepareDate($translation[$item], array_merge($key, array($item)));

Not convinced this makes sense yet. Lets go through this together.

miro_dietiker’s picture

Priority: Normal » Major

Still the bug looks severe. Raising prio to get attention.

edurenye’s picture

Done the changes proposed by @Berdir

  • Berdir committed 8da9ceb on 8.x-1.x authored by edurenye
    Issue #2685815 by edurenye: Do not update source text after saving a...
berdir’s picture

Status: Needs review » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.