summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-10-02 09:54:07 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-10-02 09:54:07 +0200
commitf3864c5444a7e56602d25d82ad13c0d79522c97d (patch)
treef1e93c939fc82de7e8d1b77cb631a20580a0402c /apps/files/lib
parent7707bbe6482c50cfda2529c8f0d7f8c7e1e52d48 (diff)
downloadnextcloud-server-f3864c5444a7e56602d25d82ad13c0d79522c97d.tar.gz
nextcloud-server-f3864c5444a7e56602d25d82ad13c0d79522c97d.zip
Use shorter text on the sidebar for files activities
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/activity.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/files/lib/activity.php b/apps/files/lib/activity.php
index bf80d0cfd7c..f3bbff48640 100644
--- a/apps/files/lib/activity.php
+++ b/apps/files/lib/activity.php
@@ -145,6 +145,24 @@ class Activity implements IExtension {
}
$l = $this->getL10N($languageCode);
+
+ if ($this->activityManager->isFormattingFilteredObject()) {
+ $translation = $this->translateShort($text, $l, $params);
+ if ($translation !== false) {
+ return $translation;
+ }
+ }
+
+ return $this->translateLong($text, $l, $params);
+ }
+
+ /**
+ * @param string $text
+ * @param IL10N $l
+ * @param array $params
+ * @return bool|string
+ */
+ protected function translateLong($text, IL10N $l, array $params) {
switch ($text) {
case 'created_self':
return (string) $l->t('You created %1$s', $params);
@@ -171,6 +189,26 @@ class Activity implements IExtension {
}
/**
+ * @param string $text
+ * @param IL10N $l
+ * @param array $params
+ * @return bool|string
+ */
+ protected function translateShort($text, IL10N $l, array $params) {
+ switch ($text) {
+ case 'changed_by':
+ return (string) $l->t('Changed by %2$s', $params);
+ case 'deleted_by':
+ return (string) $l->t('Deleted by %2$s', $params);
+ case 'restored_by':
+ return (string) $l->t('Restored by %2$s', $params);
+
+ default:
+ return false;
+ }
+ }
+
+ /**
* The extension can define the type of parameters for translation
*
* Currently known types are: