mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Use shorter text on the sidebar for files activities
This commit is contained in:
parent
7707bbe648
commit
f3864c5444
1 changed files with 38 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
@ -170,6 +188,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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue