summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib/Check/FileSize.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/lib/Check/FileSize.php')
-rw-r--r--apps/workflowengine/lib/Check/FileSize.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/workflowengine/lib/Check/FileSize.php b/apps/workflowengine/lib/Check/FileSize.php
index 70071757c12..1744793dec7 100644
--- a/apps/workflowengine/lib/Check/FileSize.php
+++ b/apps/workflowengine/lib/Check/FileSize.php
@@ -23,6 +23,7 @@ namespace OCA\WorkflowEngine\Check;
use OCP\Files\Storage\IStorage;
+use OCP\IL10N;
use OCP\IRequest;
use OCP\Util;
use OCP\WorkflowEngine\ICheck;
@@ -32,13 +33,18 @@ class FileSize implements ICheck {
/** @var int */
protected $size;
+ /** @var IL10N */
+ protected $l;
+
/** @var IRequest */
protected $request;
/**
+ * @param IL10N $l
* @param IRequest $request
*/
- public function __construct(IRequest $request) {
+ public function __construct(IL10N $l, IRequest $request) {
+ $this->l = $l;
$this->request = $request;
}
@@ -80,11 +86,11 @@ class FileSize implements ICheck {
*/
public function validateCheck($operator, $value) {
if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) {
- throw new \UnexpectedValueException('Invalid operator', 1);
+ throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
}
if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) {
- throw new \UnexpectedValueException('Invalid file size', 2);
+ throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2);
}
}