Module currently stores info on author of translation, timestamp translation was created, timestamp translation was modified, but it does not have any info on the UID it was modified by; so there's no way to tell who last modified the translation.

This is very much needed for security & usability purposes.

Comments

plach’s picture

Status: Active » Postponed (maintainer needs more info)

Neither nodes have such an information. Am I missing something?

timofey’s picture

Component: Code » Base system

You're right. I guess my question should be - Should there be an "entity_revision_translation" table to store revision info? Like node_revision, field_revision tables...

timofey’s picture

StatusFileSize
new43.3 KB

For example, my site has contributors and translators. I can see who last contributed and edited the contribution. But I cannot see who last updated the translation, I can only see who originally translated

autoplat

plach’s picture

Status: Postponed (maintainer needs more info) » Active
odegard’s picture

Category: Feature request » Bug report
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.01 KB

Reviving this instead of creating new thread.

Since timofey posted the bug in 2012 ET now supports revisions. Great!

However, this particular feature is still missing, or rather, i think it's a bug.

This is what happens in doSaveTranslations now:

    if (count($translations->data)) {
      $columns = array('entity_type', 'entity_id', 'revision_id', 'language', 'source', 'uid', 'status', 'translate', 'created', 'changed');
      $query = db_insert($table)->fields($columns);

      // These values should override the translation ones as they are not
      // supposed to change.
      $overrides = array(
        'entity_type' => $this->entityType,
        'entity_id' => $this->entityId,
        'revision_id' => $this->isRevisionable() ? $this->revisionId : $this->entityId,
      );

      // These instead are just defaults.
      $defaults = array(
        'source' => '',
        'uid' => $GLOBALS['user']->uid,
        'translate' => 0,
        'status' => 0,
        'created' => REQUEST_TIME,
        'changed' => REQUEST_TIME,
      );

      foreach ($translations->data as $translation) {
        $translation = $overrides + $translation + $defaults;
        $query->values($translation);
      }

      $query->execute();
    }

Adding arrays adds, but does not replace/update values that are old. $defaults['uid'] is set correctly, but not saved. So the new revision will always show the original authors uid.

I've made a stab at fixing this, see attached patch.

The foreach loop is changed to

      foreach ($translations->data as $translation) {
        $translation = $overrides + $translation + $defaults;

        // Set correct revision uid if this is an updated translation.
        if (!empty($translation['source']) && $translation['language'] == $this->getFormLanguage()) {
          $translation['uid'] = $GLOBALS['user']->uid;
        }

        $query->values($translation);
      }

I'm thinking that we need to make sure we're not polluting the original translation and only update the correct translation (in case there are > 2 languages enabled).

I'm not 100% sure $this->getFormLanguage() is the correct method for this purpose, but it seems to work.