aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib/Check/AbstractStringCheck.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-08-01 17:56:33 +0200
committerJoas Schilling <coding@schilljs.com>2016-08-01 17:56:33 +0200
commit6aa5d674d63db69367c97e7241e7d1575ef82690 (patch)
tree74600c656ba8034fd20847cf9853d748df30d189 /apps/workflowengine/lib/Check/AbstractStringCheck.php
parentea4c6bd28568bce811c275d46478f44455cf237d (diff)
downloadnextcloud-server-6aa5d674d63db69367c97e7241e7d1575ef82690.tar.gz
nextcloud-server-6aa5d674d63db69367c97e7241e7d1575ef82690.zip
Translate the errors
Diffstat (limited to 'apps/workflowengine/lib/Check/AbstractStringCheck.php')
-rw-r--r--apps/workflowengine/lib/Check/AbstractStringCheck.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php
index 77576266fcf..0fd728e3496 100644
--- a/apps/workflowengine/lib/Check/AbstractStringCheck.php
+++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php
@@ -23,6 +23,7 @@ namespace OCA\WorkflowEngine\Check;
use OCP\Files\Storage\IStorage;
+use OCP\IL10N;
use OCP\WorkflowEngine\ICheck;
abstract class AbstractStringCheck implements ICheck {
@@ -30,6 +31,16 @@ abstract class AbstractStringCheck implements ICheck {
/** @var array[] Nested array: [Pattern => [ActualValue => Regex Result]] */
protected $matches;
+ /** @var IL10N */
+ protected $l;
+
+ /**
+ * @param IL10N $l
+ */
+ public function __construct(IL10N $l) {
+ $this->l = $l;
+ }
+
/**
* @param IStorage $storage
* @param string $path
@@ -81,12 +92,12 @@ abstract class AbstractStringCheck implements ICheck {
*/
public function validateCheck($operator, $value) {
if (!in_array($operator, ['is', '!is', 'matches', '!matches'])) {
- throw new \UnexpectedValueException('Invalid operator', 1);
+ throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
}
if (in_array($operator, ['matches', '!matches']) &&
@preg_match($value, null) === false) {
- throw new \UnexpectedValueException('Invalid regex', 2);
+ throw new \UnexpectedValueException($this->l->t('The given regular expression is invalid'), 2);
}
}