diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-04-25 12:57:34 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-04-25 12:57:34 +0200 |
commit | 604b7a49f61a166f8e2db52ea64b85d9cc5fd531 (patch) | |
tree | 362fde49738dc3b99d832730f415ec1a2753cdb6 /apps | |
parent | 7a22e3f083af7a7c64a022af6e6e5aa9e478cc6a (diff) | |
parent | d4c9566cd564d440f28e7fcc75bfe114a048b704 (diff) | |
download | nextcloud-server-604b7a49f61a166f8e2db52ea64b85d9cc5fd531.tar.gz nextcloud-server-604b7a49f61a166f8e2db52ea64b85d9cc5fd531.zip |
Merge pull request #24230 from owncloud/you-form-of-activities
Translate the current user with "You ..."
Diffstat (limited to 'apps')
-rw-r--r-- | apps/systemtags/activity/extension.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/systemtags/activity/extension.php b/apps/systemtags/activity/extension.php index 4a974611509..8c101a6f550 100644 --- a/apps/systemtags/activity/extension.php +++ b/apps/systemtags/activity/extension.php @@ -142,9 +142,15 @@ class Extension implements IExtension { switch ($text) { case self::ASSIGN_TAG: $params[2] = $this->convertParameterToTag($params[2], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You assigned system tag %3$s', $params); + } return (string) $l->t('%1$s assigned system tag %3$s', $params); case self::UNASSIGN_TAG: $params[2] = $this->convertParameterToTag($params[2], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You unassigned system tag %3$s', $params); + } return (string) $l->t('%1$s unassigned system tag %3$s', $params); } @@ -162,19 +168,34 @@ class Extension implements IExtension { switch ($text) { case self::CREATE_TAG: $params[1] = $this->convertParameterToTag($params[1], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You created system tag %2$s', $params); + } return (string) $l->t('%1$s created system tag %2$s', $params); case self::DELETE_TAG: $params[1] = $this->convertParameterToTag($params[1], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You deleted system tag %2$s', $params); + } return (string) $l->t('%1$s deleted system tag %2$s', $params); case self::UPDATE_TAG: $params[1] = $this->convertParameterToTag($params[1], $l); $params[2] = $this->convertParameterToTag($params[2], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You updated system tag %3$s to %2$s', $params); + } return (string) $l->t('%1$s updated system tag %3$s to %2$s', $params); case self::ASSIGN_TAG: $params[2] = $this->convertParameterToTag($params[2], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You assigned system tag %3$s to %2$s', $params); + } return (string) $l->t('%1$s assigned system tag %3$s to %2$s', $params); case self::UNASSIGN_TAG: $params[2] = $this->convertParameterToTag($params[2], $l); + if ($this->actorIsCurrentUser($params[0])) { + return (string) $l->t('You unassigned system tag %3$s from %2$s', $params); + } return (string) $l->t('%1$s unassigned system tag %3$s from %2$s', $params); } @@ -182,6 +203,20 @@ class Extension implements IExtension { } /** + * Check if the author is the current user + * + * @param string $user Parameter e.g. `<user display-name="admin">admin</user>` + * @return bool + */ + protected function actorIsCurrentUser($user) { + try { + return strip_tags($user) === $this->activityManager->getCurrentUserId(); + } catch (\UnexpectedValueException $e) { + return false; + } + } + + /** * The extension can define the type of parameters for translation * * Currently known types are: |